How to load the image into one or more axes at the same time?

2 views (last 30 days)
I have to use following code for load the two different images for different axes. But i got the Error message How to rectify that error?
??? Cell contents reference from a non-cell array object.
Error in ==> colrc>imagebtn_Callback at 84
filename=fullfile(Folder,File{iFile});
Error in ==> gui_mainfcn at 96 feval(varargin{:});
Error in ==> colrc at 42 gui_mainfcn(gui_State, varargin{:});
Error in ==> @(hObject,eventdata)colrc('imagebtn_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
Code:
function imagebtn_Callback(hObject, eventdata, handles)
% hObject handle to imagebtn (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[File,Folder]=uigetfile('*.*','Multiselect','on');
handles.img=cell(1,length(File));
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);
Please any one help this problem.

Accepted Answer

Walter Roberson
Walter Roberson on 6 Feb 2013
filename=fullfile(Folder,File(iFile).name);
but like I warned you in your earlier question, you are going to have problems unless you have already created the axes you are referencing through handles.axes{iFile}

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!