App designer - How To Re-Run an app

1 回表示 (過去 30 日間)
youjarr
youjarr 2019 年 5 月 21 日
回答済み: Ajay Kumar 2019 年 10 月 3 日
Hey guys,
i have designed an app with app designer.
In this app i habe an "run" button which runs a function within the app.
This is the run buttons callbackfcn:
if(app.NumberoffilesEditField.Value < 1)
f = msgbox('You forgot to type the number of files and the Prefix for the filename', 'Error','error');
elseif(strcmp(app.PrefixforfilenameEditField.Value,'Measurement') == 1 || isempty(app.PrefixforfilenameEditField.Value))
DateNow = datestr(now);
app.pNameOfFiles = matlab.lang.makeValidName(DateNow,'Prefix','Measurement_');
app.PrefixforfilenameEditField.Value = app.pNameOfFiles;
app.Lamp.Color = 'yellow';
app.pNoFiles = app.NumberoffilesEditField.Value;
app.pNameOfFiles = app.PrefixforfilenameEditField.Value;
app.pNameOfFiles = [app.pNameOfFiles, '_'];
func(app)
app.Lamp.Color = 'green';
pause(5)
app.Lamp.Color = 'red';
end
close all;
Now if I want to re-run the app... nothing happens?
What could be the reason for that?

回答 (1 件)

Ajay Kumar
Ajay Kumar 2019 年 10 月 3 日
close all deletes all the variables in the workspace, making the previously stored attributes inaccessible.
Try commenting out last line and run it.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by