PDA

View Full Version : Matlab " Missing Matlab operator"


Salam
Mar16-09, 06:45 AM
1. The problem statement, all variables and given/known data

i am new to matlab, i am trying to read many images named , salam(1).jpg, salam(2).jpg,...,salam(n).jpg, and i am trying to put that in the imread function as shown in the code below

counter =1;
while (counter<5)
cur=imread('salam(' int2str(counter) ').jpg');
counter=counter+1;
end

but i am getting the following error

??? cur=imread('salam(' int2str(counter) ').jpg');
|
Error: Missing MATLAB operator.

Predictor
Mar16-09, 08:15 AM
The problem is that imread is expecting a single string parameter. You need to concatenate the components of the file name, by wrapping them in square brackets:

cur=imread(['salam(' int2str(counter) ').jpg']);


-Will Dwinnell
Data Mining in MATLAB (http://matlabdatamining.blogspot.com/)

Salam
Mar16-09, 12:34 PM
Thank you very much Predictor, it is working now :)