Is it possible to save a corrupted .mlapp file?
4 views (last 30 days)
Show older comments
Ricardo Burbano Escolà
on 8 May 2023
Commented: dpb
on 10 May 2023
It all was working well until I tried to use the "save" function to save a variable. When I tried to run the code, it suddenly froze, so I closed the project. When trying to open it again, it displayed the following message: "Error loading LANXI_DAQ.mlapp". Also, this is what appears in the Matlab Command Window:
I stumbled upon someone that had a similar problem, and could edit the .mlapp file by converting it into a .zip and editing the contents inside, but I hasn't worked for me. Any ideas on how could this issue be solved? I attach all the project files just in case someone knows how to fix it.
Thank you in advance.
0 Comments
Accepted Answer
Image Analyst
on 8 May 2023
The problem is you gave the name of your .mlapp file as the name for your MAT file when you saved it. This is a disaster. Basically, because you did not change the name of the file to give it an extension of ".mat" instead of ".mlapp" you overwrite your .mlapp file. This is not recoverable. Hopefully you have a backup. Look for a file called LANXI_DAQ.asv. If that file is not there then you will have to rebuild your app from scratch. Hard lesson to learn, but make sure you really know what the filename is of the mat file you are trying to create. You should have done this:
% Get base file name of the .mlapp file.
[folder, baseFileNameNoExt, ext] = fileparts(mfilename('full'))
% Get a new filename for the output .MAT file that has a .mat extension.
matFullFileName = fullfile(folder, [baseFileNameNoExt, '.mat'])
4 Comments
Image Analyst
on 8 May 2023
Edited: Image Analyst
on 9 May 2023
@dpb yes, that does seem bizarre that backups are only made for .m (and maybe .mlx?) files and not for .mlapp files. I've sent tech support a question about whether this oversight is an intentional feature or a bug.
[UPDATE] Tech support tells me that there is no capability for App Designer to automatically save backup files like the regular editor does. 😢 I've put in a feature enhancement request for it.
The best they could suggest was to check the box in the Preferences->App Designer to have it save the file if you ever navigated away from App Designer, but that won't create a second/older copy, it just does an immediate save.
dpb
on 10 May 2023
@Image Analyst, thanks for update and making the feature request; does seem to be a significant oversight in the UI.
More Answers (0)
See Also
Categories
Find more on File Operations 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!