MATLAB Answers

How to cancel impoly, imcrop, etc. in GUI?

1 view (last 30 days)
Dominik Mattioli
Dominik Mattioli on 20 Mar 2018
Edited: Dominik Mattioli on 20 Mar 2018
Suppose that there is an image in an axis of a GUI (created via guide) and a button that calls imcrop. After pushing this button, I type ctrl-c in the command window to cancel the operation and the following error is printed in the command window: "Operation terminated by user during uiwait". Any future pushes of that same button will now result in an error and that button is unusable until the GUI is relaunched.
Is there anyway to avoid this? I am not using any uiwait functions. See comment for the error dialogue.

  1 Comment

Dominik Mattioli
Dominik Mattioli on 20 Mar 2018
My button's callback func. is called "identifyImageReferences_Callback" and my gui script is called "mainGUI".
Error using matlab.graphics.primitive.Line/set
Invalid or deleted object.
Error in wingedRect/setModeInvariantObjVisible (line 170)
set(h_wing_line,'Visible',onOff);
Error in wingedRect/setVisible (line 150)
setModeInvariantObjVisible('on');
Error in imrect>imrectAPI/placeRect (line 360)
draw_api.setVisible(true);
Error in manageInteractivePlacement/buttonDownPlaceObject
(line 211)
completed = placementFcn(x_init,y_init);
Error in iptaddcallback/callbackProcessor (line 149)
fun(varargin{:});
Error using uiwait (line 81)
Error while evaluating Figure WindowButtonDownFcn.
Index exceeds array bounds.
Error in wingedRect/updateView (line 189)
x_side_markers = [position(1),
position(1)+position(3)/2,...
Error in imrect>imrectAPI/updateView (line 444)
draw_api.updateView(pos);
Error in imrect>imrectAPI (line 312)
updateView(position);
Error in imrect (line 82)
[h_group,draw_api] = imrectAPI(varargin{:});
Error in iptui.imcropRect (line 32)
obj =
obj@imrect(parent,position,'positionConstraintFcn',snapToPixelsFcn);
Error in imcrop>interactiveCrop (line 356)
h_rect = iptui.imcropRect(hAx,[],h_image);
Error in imcrop>parseInputs (line 236)
[spatial_rect,h_image,placement_cancelled] =
interactiveCrop(gcf);
Error in imcrop (line 93)
[x,y,a,cm,spatial_rect,h_image,placement_cancelled] =
parseInputs(varargin{:});
Error in identifyImageReferences (line 14)
[~,nerveCrop] =
imcrop(handles.figure1.UserData.AdjustedImage);
Error in mainGUI>button_IdentifyImageReferences_Callback (line
374)
identifyImageReferences(handles);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in mainGUI (line 41)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)main
GUI('button_IdentifyImageReferences_Callback',hObject,eventdata,guidat
a(hObject))
Error while evaluating UIControl Callback.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!