Call an attribute from a Matlab script in AppDesigner GUI

2 views (last 30 days)
I have created a GUI with app designer which launch a matlab program after the user chose a file and pressed launch button :
function LaunchButtonPushed(app, event)
app.ResultWindowTextArea.BackgroundColor = 'green';
app.ResultWindowTextArea.FontSize = 20;
app.ResultWindowTextArea.Value = 'Launch of the program ...';
testLectureXML(app.FileTextArea.Value{:});
if n_component == 0
app.ResultWindowTextArea.BackgroundColor = 'red';
app.ResultWindowTextArea.Value = 'Please choose a valid File !';
stop testLectureXML()
end
end
n_component is an attribute in my testLectureXML matlab program and he is equal to 0 only if the file that the user chose is empty. But it's like my application doesn't recognize n_component as the attribute of my testLectureXML program.
And if possible, if n_component = 0 i would like to stop the program
How can i do this ? Thanks !
Edit : To stop the programm i have thinking of creating
exitProgram = 0 and if exitProgram = 1 return 0
and in the GUI code i just put exitProgram = 1 if the file is empty but i don't know how to access to an attribute of a matlab script with GUI code.

Answers (0)

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!