1

我用应用程序设计器创建了一个 GUI,它在用户选择一个文件并按下启动按钮后启动一个 matlab 程序:

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是我的testLectureXMLmatlab 程序中的一个属性,只有当用户选择的文件为空时,他才等于 0。但这就像我的应用程序无法识别n_component为我的testLectureXML程序的属性一样。

如果可能的话,如果n_component = 0我想停止程序

我怎样才能做到这一点 ?谢谢 !

编辑:为了停止程序,我正在考虑创建exitProgram = 0 and if exitProgram = 1 return 0和在 GUI 代码中,exitProgram = 1如果文件为空,但我不知道如何使用 GUI 代码访问 matlab 脚本的属性。

4

0 回答 0