Cannot open .mlapp file in app designer

9 visualizzazioni (ultimi 30 giorni)
Daniel Horvath
Daniel Horvath il 12 Mag 2022
Risposto: Nivedita il 20 Set 2023
Hello,
I've been working on a project in app designer and I ran into a major issue. I wanted to add a dialog box which would popup when I pressed a certain button and after writing the code for the dialog box I pressed the run button and nothing happened and after a few more tries with the same result, the project ended up closing by itself. Once I tried to open it again, an error dialog box appeared with "Error loading <project_name.mlapp>". I'm not sure if this is related to the dialog box that I tried to add because I loaded the project on a separate computer using Matlab 2020b (I originally created the project in Matlab R2021b) and it loaded just fine. I didn't try to run it, but I deleted the lines of code related to the dialog box and saved it, but I still get the same result when I try loading it on my R2021b Matlab version.
How can I fix this issue?
I've also uploaded the .mlapp file if it's needed.

Risposte (1)

Nivedita
Nivedita il 20 Set 2023
Hello Daniel!
I understand that whenever you are trying to open the attached app, you are getting the dialog box with “Error loading <project_name.mlapp>”.
I faced the same issue when trying to open the attached app. Please ensure that if your app relies on any external functions or files, make sure all the necessary dependencies are available and accessible. Check if any required files are missing or if the paths to those files are incorrect.
To add a dialog box to popup when a certain button is pressed, you can use the “KeyPressFcn” callback function to achieve the same in the following manner:
function UIFigureKeyPress(app, event)
if strcmp(event.Key, 'a')
% Display a dialog box
uialert(app.UIFigure, 'You pressed the "a" key!', 'Key Pressed', 'Icon', 'info');
end
end
The above code will pop up an info dialog box with the given message upon pressing the ‘a’ key. You can customise the message and key according to your requirements.
For more information on the “KeyPressFcn” callback function, you can refer to the following documentation:
I hope this helps!
Regards,
Nivedita.

Categorie

Scopri di più su Environment and Settings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by