How to understand the Matlab error of "Expected axes containing HIMAGE to be a child of HPARENT."

1 view (last 30 days)
Hi all,
I am working at how to display two refreshed figures on screen. data1 and data2 will be refreshed in each loop(I didn't show the refreshing code for data1 and data2 here).
The error for this code below is: Error using imscrollpanel>validateHandles (line 1370) Expected axes containing HIMAGE to be a child of HPARENT.
I only know this error is from repeated call for imscrollpanel in the loop, but don't know how to solve it. Could you help? The code is as below:
testFig1=figure(1);
axis1=gca;
testFig2=figure(2);
axis2=gca;
for i=1:10
testImg1=imshow(data1,[],'parent',axis1);
testImg2=imshow(data2,[],'parent',axis2);
imscrollpanel(testFig2,testImg2);
%cla
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!