So I have 10 images at the working directory(which is desktop) and named them as image1.jpg, image2.jpg, … image10.jpg and I want to load into matlab and save them in cells. But apparently it saves the first image, but fails to do the same for the rest.
photo=cell(1,10);for i=1:10 filename=['image',num2str(i),'.jpg']; photo{i}=imread(filename);end
and I get errors like:
Error using imread>get_full_filename (line 481) File "image2.jpg" does not exist.
Error in imread (line 344) filename = get_full_filename(fid, errmsg, filename);
Error in Untitled (line 5) photo{i}=imread(filename);
what should I do to make it work?
Best Answer