MATLAB: How to set one image into multiple axes

imagemultiple_axesmultipleaxessetset_image

Hi everyone. I need some help to add one image into multiple axes.
I want my program to be something like on this picture:
When I select open image menu, it will browse for a picture. Then, I want that one picture to be displayed on those three axes area (Method A, Method B, and Proposed Method).
Here's my current code. PS: Please don't laugh at my code because i'm still a newbie here.
function open_Callback(hObject, eventdata, handles)
% hObject handle to open (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
project=guidata(gcbo);
[filename,directory]=uigetfile({'*.bmp';'*.*'},'Open Image');
I=imread(strcat(directory,filename));
I1=imread(strcat(directory,filename));
I2=imread(strcat(directory,filename));
set(project.figure1,'CurrentAxes',project.axes1);
set(imshow(I));
set(project.axes1,'Userdata',I);
set(project.figure1,'Userdata',I);
set(project.figure3,'CurrentAxes',project.axes3);
set(imshow(I1));
set(project.axes3,'Userdata',I1);
set(project.figure3,'Userdata',I1);
set(project.figure4,'CurrentAxes',project.axes4);
set(imshow(I2));
set(project.axes4,'Userdata',I2);
set(project.figure4,'Userdata',I2);
Can i get some help guys? Any advice would be highly appreciated.

Best Answer

Pearly - perhaps try using the Parent property of imshow to indicate which axes you wish to "show" the image on. For example,
% read the image
myImg = imread(fullfile(directory,filename));
% show the image on each axes
imshow(myImg,'Parent',handles.axes1);
imshow(myImg,'Parent',handles.axes2);
imshow(myImg,'Parent',handles.axes2);
The above eliminates the need to read the image three times from file. Note how fullfile is used to concatenate the filename parts. Also, the handles structure is used to obtain the handle to each of the three axes (as opposed to the project that you are referencing).
Try the above and see what happens!
Related Question