I have the problem of Error Dialog.
6 views (last 30 days)
Show older comments
I'm trying to open my MATLAB file but it's doesn't open. keep on writting this error which I don't understand because I lasp open my file on the 23/08/24.
1 Comment
dpb
on 12 Sep 2024
Hopefully you have a backup because it appears somehow that one has become corrupted.
Unfortunately, while I don't have Simulink to compare, it does seem that occasionally .mat files also become unreadable for no known or discernible reason; it would appear from the error message something similar has happened there.
Answers (1)
nick
on 13 Sep 2024
Hi Nothile,
It looks like you're experiencing issues with a corrupted SLX file in Simulink. By attempting to load the Simulink model into memory and then saving it with a new file name, you may be able to recover the model. Here's a MATLAB script that demonstrates the same:
load_system('Model_Name');
bdroot % Returns the top-level model of the system and checks if the model is loaded
save_system('Model_Name','New_File_Name')
Replace 'Model_Name' with the name of your corrupted SLX file, and 'New_File_Name' with the desired name for the new file.
You can refer to the MATLAB documentation to learn more about the functions 'load_system' and 'save_system':
If this workaround doesn't resolve the issue, I recommend reaching out to MathWorks Technical Support for further assistance:
3 Comments
dpb
on 13 Sep 2024
@NOTHILE LUNGELENI, @nick specifically said "Replace 'Model_Name' with the name of your corrupted SLX file," not to blindly just copy and paste.
However, it's highly unlikely that load_system will open the model file if it fails to open normally.
Whether Tech Support can help is also problematic, but all they can do is say, "Sorry!" if not, so nothing would be lost by trying.
If you do not have a backup or earlier copy of the model, unfortunately, I expect the bad news is you'll be rebuilding it from scratch.
See Also
Categories
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!