Matlab Missing Matlab operator

  • Thread starter Thread starter Salam
  • Start date Start date
  • Tags Tags
    Matlab Operator
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 7K views
Salam
Messages
2
Reaction score
0
Matlab " Missing Matlab operator"

Homework Statement



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

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

but i am getting the following error

Code:
?         cur=imread('salam(' int2str(counter) ').jpg');
                                |
Error: Missing MATLAB operator.
 
Last edited:
Physics news on Phys.org


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
http://matlabdatamining.blogspot.com/"
 
Last edited by a moderator:


Thank you very much Predictor, it is working now :)