解决user interface - How to use impoly with msgbox in matlab gui?
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
Problem: Now the problem is after clicking the
ok button on 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 :
matlab user-interface image-processing matlab-figure matlab-guide
% --- 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
this question asked Jan 30 '16 at 15:20 sakyan 15 5
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
- 4Matlab textread函数详解
- 5Matlab 线性拟合 & 非线性拟合