Is it possible to recover a corrupted *.mlapp file?

18 ビュー (過去 30 日間)
Matt Brown
Matt Brown 2022 年 8 月 10 日
回答済み: Max Scharrenbroich 2024 年 4 月 4 日 19:38
I was working on an app and had just got the thing to work when the file became corrupted. When I tried to run the file (and now when I try to open it), I get an error dialog:
"Error loading 'PlotDigitizer.mlapp'.
And then this appears in the command window:
"Error using which
C:\Work\Matlab\Apps\Plot Digitizer\PlotDigitizer.mlapp: Can't open file.
Error in run (line 55)
pathscript = evalin('caller', strcat('which(''', script, ''')'));"
I tried to find a solution to this online and came up with reseting preferences... which didn't work.
This the second time this has occured, forcing me to loose several hours of work, and I am not even sure what I did to cause it, if anything. It seemingly worked one minute and then not the next.
Is App Designer that unstable? Is there a way to recover this or at least copy the text portion of the code?
Also, what options do I have for backup or autosave?
  2 件のコメント
Matt J
Matt J 2022 年 8 月 10 日
If you restart Matlab, is the result any different?
Matt Brown
Matt Brown 2022 年 8 月 11 日
Negative. Reseting the preferences required a restart of Matlab.
I attached the *.mlapp file to the original post if you want to give it a shot.

サインインしてコメントする。

採用された回答

Robert Philbrick
Robert Philbrick 2022 年 8 月 15 日
編集済み: Robert Philbrick 2022 年 8 月 15 日
The app became corrupt due to an invalid character entered on line 413:
if(c == <escape character here>) % Exit when Esc key is pressed
The "escape" character that you used is not supported in the MLAPP code file. This is a bug and I have reported it to the App Designer team.
I fixed the app (attached) so that it will now load by removing the escape character and replacing it with 'escape'. A better way to detect if the user has pressed the escape key is to add a KeyPressFcn to your app's UIFigure and use the event.Key in the callback to determine if escape was pressed:
function UIFigureKeyPress(app, event)
key = event.Key;
% Check if key == 'escape'
end
  2 件のコメント
Matt Brown
Matt Brown 2022 年 8 月 16 日
Thank you very much for the fix and advice!
mshdi mahdaklm as
mshdi mahdaklm as 2022 年 10 月 30 日
can you tell me how to fix files like this?

サインインしてコメントする。

その他の回答 (1 件)

Max Scharrenbroich
Max Scharrenbroich 2024 年 4 月 4 日 19:38
If the .mlapp is corrupted you can still recover user-defined code and other things by opening the .mlapp as an archive using 7-zip.

カテゴリ

Help Center および File ExchangePackage and Share Apps についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by