Why am I getting the error "Failed to create or open file system output stream"?
23 views (last 30 days)
Show older comments
When I try to save my simulink model which I have imported from version 2018b to .mdl file i get following error:
Saving the model to .slx file is working.
Matlab is running with Admin rights.
2 Comments
Walter Roberson
on 23 May 2022
Does the Temp directory exist? How about the directory all the way down to bdmxdata ?
Is there a particular reason you are runing with Admin rights?
Answers (1)
Abhishek Chakram
on 26 Dec 2023
Hi Matthaeus leimer,
I understand that you are facing difficulty in saving a Simulink file in “.mdl” format. The “.mdl” file format was used in MATLAB R2018b and earlier. While newer versions of MATLAB can still open and save “.mdl” files for backward compatibility, there may be issues related to the conversion process or file access permissions. Here are few steps to resolve the issue:
- File Path Length: The error message suggests that MATLAB is trying to write to a temporary file with a very long path. Windows has a maximum path length limitation (MAX_PATH) of 260 characters. Try saving the file to a directory with a shorter path to avoid hitting this limit.
- Temporary Folder Permissions: MATLAB is attempting to write to a temporary folder within the user's AppData directory. Ensure that MATLAB has the necessary permissions to write to this folder. Although you mentioned that MATLAB is running with admin rights, it's worth double-checking the specific folder permissions.
- Clear Temporary Files: Clear out MATLAB's temporary files by using the “tempdir” command to find the temp directory and manually deleting the files, or by restarting MATLAB, which should clear its temporary state.
- Save As Different Name: Try saving the model with a different name or in a different location to see if the issue is specific to that file path or name.
You can refer to the following documentation to know more about the functions used:
Best Regards,
Abhishek Chakram
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!