how to load image in different axes(axes1,axes2,axes3) using single pushbutton???...
Show older comments
I have to use two axes and two pushbutton to load the image.
_% --- Executes on button press in imagebtn.
function imagebtn_Callback(hObject, eventdata, handles)
[baseFileName,folder]=uigetfile('*.*','Specify an image file','on');
fullimageFileName=fullfile(folder,baseFileName);
axes1=imread(fullimageFileName);
axes(handles.axes1);
image(axes1)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
[baseFileName,folder]=uigetfile('*.*','Specify an image file','on');
fullimageFileName=fullfile(folder,baseFileName);
axes2=imread(fullimageFileName);
axes(handles.axes2);
image(axes2)._
But I saw the code for load different image using single button program source code in matlab. But sure I am not understand that code in some line in that program. I used that code But so many error occured. Reason i am not tell properly how to handle the axes. how to give the Tag name for Axes. For Example
[File,Folder]=uigetfile('*.*','Multiselect','on');
% i think this the probles
handles.img=cell(1,length(File)); % what puropse using that img(handles.img)
for iFile=1:length(File)
filename=fullfile(Folder,File{iFile});
image=imread(filename);
axes(handles.axes{iFile});
imshow(image);
handles.img{iFile}=image;
end guidata(hObject,handles);
I got Following Error.
??? Cell contents reference from a non-cell array object.
Error in ==> Clrc>pushbutton2_Callback at 119 filename = fullfile(Folder, File{iFile});
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> arambam at 42 gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)arambam('pushbutton2_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
1 Comment
Walter Roberson
on 6 Feb 2013
You should have read my warning about that code. Which I repeated in http://www.mathworks.co.uk/matlabcentral/answers/62425-how-to-load-the-image-into-one-or-more-axes-at-the-same-time
Accepted Answer
More Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!