【问题标题】:How to program a dialog box in GUI, Matlab?如何在 GUI、Matlab 中编写对话框?
【发布时间】:2023-03-21 05:02:01
【问题描述】:

我在 Matlab (GUI) 中有一个带有“确定”按钮的对话框。

h = msgbox('请按确定显示图像')

然后我使用 imshow 显示该图像:

imshow('myImage.jpg')

我希望 GUI 等待用户的响应(按 OK)然后显示图像,但现在这两个同时发生。我该如何解决这个问题?

感谢您的帮助

【问题讨论】:

    标签: matlab user-interface


    【解决方案1】:

    使用uiwait并将消息对话框设置为modalimshow之前:

    uiwait(msgbox('Please press Ok to display the image','Test msg box','modal'));
    

    或:

    h = msgbox('Please press Ok to display the image','Test msg box','modal');
    uiwait(h);
    

    【讨论】:

      猜你喜欢
      • 2010-11-10
      • 2013-08-04
      • 1970-01-01
      • 1970-01-01
      • 2010-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多