0

so the problem is that i have 5 images in one figure "fig1" and i want to send the to second figure "fig2" also "fig2" is opened by a push button in fig1 when i press the button fig2 it is supposed to open fig2 with the images loadedbut when fig2 is opened the axis are empty while if i start fig2 by it self it will open the images loaded to the previous figure fig1 the code

-for sharing the images:

in fig1:

setappdata(0,'reimage1',original_image);

setappdata(0,'reimage2',image1);

setappdata(0,'reimage3',image2);

setappdata(0,'reimage4',image3);

setappdata(0,'reimage5',image4);

in fig2:

image1 = getappdata(0,'reimage1');

axes(handles.axes1);

imshow(image1)

image2 = getappdata(0,'reimage2');

axes(handles.axes2);

imshow(image2,[])

image3 = getappdata(0,'reimage3');

axes(handles.axes3);

imshow(image3,[])

image4 = getappdata(0,'reimage4');

axes(handles.axes4);

imshow(image4,[])

image5 = getappdata(0,'reimage5');

axes(handles.axes5);

imshow(image5,[])

also the code for the button in fig1 to open the second figure is kind of simple

openfig('fig2.fig')
Jean-Bernard Pellerin
  • 12,556
  • 10
  • 57
  • 79
m131313
  • 27
  • 1
  • 5

1 Answers1

0

Have you tried explicitly setting the parent during your call to imshow?

For example:

imshow(image5, [], 'Parent', handles.axes5)
Huguenot
  • 2,427
  • 2
  • 17
  • 14