AppDesigner .mlapp won't open because of code error

2 views (last 30 days)
Skip to the EDIT section.
I recently saved and closed an app I was working on with a code error
results_folder = outputs.save_path;
app. % <--- this is where the error is flagged when I try to open the .mlapp file
and now the app won't open. I get an "Array indices must be positive integers or logical values" message if I try opening it from App Designer, and the following error if I try opening it by double-clicking it from within MATLAB (running the app):
Invalid expression. Check for missing or extra characters.
with the line number called, which is what I have in the first code block above.
I've tried the method documented here:
and can access the .xml and EditableSelectionCode. I've set those 2 lines above to empty strings ( '' ) in both the cell array that's in appModel.code.EditableSectionCode and in document.xml, and re-compressed it as a .zip, and changed the extension to .mlapp. But that file won't open at all. I get a generic "Can't open file" error (Fixed this part, see below).
What can I do? This application has seen many hours of hard work, and now is completely in accessible due to a simple typo?
EDIT:
I was able to remove the 2-lines above in EdiableSectionCode and document.xml, and re-zip (I was zipping at the parent folder level, rather than the subfolder level, zipping the contents of the folder creates a file that can run in MATLAB). The app will now RUN, but I stil can't edit it.
I get the same error I was getting before when I tried opening it from App Designer:
Which is a really frustrating error given that it doesn't tell me what array indices where need to be integers or logical values, and it's not trivial to open the app code in an editor...

Answers (2)

Mario Malic
Mario Malic on 8 Dec 2020
Hi Bryan,
It's best to contact Support for this one, and to share with them the version of the app you haven't edited manually.

dijil hicham
dijil hicham on 19 Nov 2022
Hi ,
I had the same problem. Unfortunately, I could not find a way to run the application. One solution to at least recover your source code is to create a blank project, then in the editor, click on "compare" and select your corrupted project. A window will appear with the source code.

Categories

Find more on Develop Apps Using App Designer 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!