【问题标题】:How to use impoly with msgbox in matlab gui?如何在 matlab gui 中使用 impoly 和 msgbox?
【发布时间】:2016-05-08 07:19:58
【问题描述】:

要求: 我正在创建一个 matlab gui 项目。我的代码中有一个pushbutton,单击时会创建一个figure,显示来自父GUI 的图像,并带有msgbox 作为弹出窗口。单击msgbox 上的ok 后,我想使用impoly 命令选择感兴趣的区域。

问题: 现在的问题是在单击msgbox 上的ok 按钮后,impoly 命令不起作用。鼠标指针不会变成选择器。我搜索了 matlab 文档,备用的是warndlg,但同样的情况发生了。

这是我的代码:

% --- Executes on button press in roi.
function roi_Callback(hObject, eventdata, handles)
% hObject    handle to roi (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
image=getimage(handles.axes2);    % acquire image from parent gui
figure;                           % figure;
msgbox('Select ROI for overlapped area','overlapped region');   %message box
im=imshow(image);      % to show the image in figure;
data12=impoly;         % creates a roi polygon selector
mask12=createMask(data12,im); % creates a binary mask

【问题讨论】:

    标签: matlab user-interface image-processing matlab-figure matlab-guide


    【解决方案1】:

    您必须在uiwait 函数中调用msgbox

    这允许在用户按下 OK 按钮之前阻止 callbak 的执行。

    % msgbox('Select ROI for overlapped area','overlapped region'));   %message box
    uiwait(msgbox('Select ROI for overlapped area','overlapped region'));   %message box
    

    希望这会有所帮助。 卡普拉'

    【讨论】:

    • 不客气!为了关闭问题,您可能需要将答案标记为已接受。
    猜你喜欢
    • 2016-11-17
    • 1970-01-01
    • 1970-01-01
    • 2017-01-02
    • 2014-09-30
    • 1970-01-01
    • 2014-12-25
    • 2011-12-19
    相关资源
    最近更新 更多