ITKeyword,专注技术干货聚合推荐

注册 | 登录

解决user interface - How to use impoly with msgbox in matlab gui?

itPublisher 分享于

2020腾讯云双十一活动,全年最低!!!(领取3500元代金券),
地址https://cloud.tencent.com/act/cps/redirect?redirect=1073

2020阿里云最低价产品入口,含代金券(新老用户有优惠),
地址https://www.aliyun.com/minisite/goods

Requirement : I am creating a matlab gui project. I have a pushbutton in my code, when clicked creates a figure displaying an image from the parent GUI with a msgbox as a popup. After clicking ok on the msgbox I want to select the region of interest using impoly command.

Problem: Now the problem is after clicking the ok button on the msgbox the impoly command doesn't work. The mouse pointer doesn't change into a selector. I have searched the matlab documentation and the alternate is warndlg but the same happens.

Here is my code :

% --- 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
|
  this question
asked Jan 30 '16 at 15:20 sakyan 15 5

 | 

1 Answers
1

解决方法

You have to call the msgbox within the uiwait function.

This allows blocking the execution of the callbak until the user press the OK button.

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

Hope this helps. Qapla'


|
  this answer
answered Jan 30 '16 at 15:45 il_raffa 3,131 8 15 31      Thanks a lot, It's working now. –  sakyan Jan 30 '16 at 16:13      You're welcome! In order to close the question youi might want to mark the answer as 解决方法. –  il_raffa Jan 30 '16 at 16:46

 | 


相关阅读排行


相关内容推荐

最新文章

×

×

请激活账号

为了能正常使用评论、编辑功能及以后陆续为用户提供的其他产品,请激活账号。

您的注册邮箱: 修改

重新发送激活邮件 进入我的邮箱

如果您没有收到激活邮件,请注意检查垃圾箱。