I am trying to load multiple images in Matlab GUI using for loop. Please help me rectify my errors. Thank you.

2 views (last 30 days)
Here is my code:
[File, Folder] = uigetfile('*.*', 'MultiSelect', 'on');
handles.img = cell(1, length(File));
for iFile = 1:length(File)
filename = strcat(Folder, File{iFile});
image = imread(filename);
axes(handles.axes(iFile)); % Better use a vector to store handles
imshow(image);
handles.img{iFile} = image;
end
guidata(hObject, handles);
The code is giving me errors. Please help.

Answers (1)

Walter Roberson
Walter Roberson on 23 Jul 2015
filename = fullfile(Folder, File{iFile});
When you used strcat() you were not getting the "/" or "\" between the directory and the file name.

Categories

Find more on Modeling 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!