Matthias Pospiech
Matthias Pospiech

Reputation: 3488

plot is created in wrong gui window

I have a situation where I create a waitbar, read a large image and plot the image to the gui axes. However what happens is that the plot is created inside the waitbar instead.

hWait = waitbar(0,'1','Name','Reading calibration file ...');
% why do I need the '1' in waitbar ???

readCalibrationImage( handles );

% delete( hWait ); 
set(handles.figure1,'CurrentAxes',handles.axesROI)
plotROIImage( handles, imagedata, roi, lineV, lineH, doExportPlot )            

only if I delete the handle the plot is created in the correct window.

How do I enfore plotting to the correct window?

Upvotes: 4

Views: 669

Answers (1)

Rody Oldenhuis
Rody Oldenhuis

Reputation: 38052

Try putting a

set(0, 'CurrentFigure', handles.figure1);

in front of the CurrentAxes statement. AFAIK, set(...,'CurrentAxes') does not automatically switch the active figure...

Upvotes: 3

Related Questions