Call an attribute from a Matlab script in AppDesigner GUI

1 次查看(过去 30 天)
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.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Develop Apps Using App Designer 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by