Matlab Missing Matlab operator

  • Thread starter Salam
  • Start date
Matlab " Missing Matlab operator"

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');
but i am getting the following error

???         cur=imread('salam(' int2str(counter) ').jpg');
Error: Missing MATLAB operator.
Last edited:
Re: Matlab " Missing Matlab operator"

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" [Broken]
Last edited by a moderator:
Re: Matlab " Missing Matlab operator"

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

Want to reply to this thread?

"Matlab Missing Matlab operator" You must log in or register to reply here.

Physics Forums Values

We Value Quality
• Topics based on mainstream science
• Proper English grammar and spelling
We Value Civility
• Positive and compassionate attitudes
• Patience while debating
We Value Productivity
• Disciplined to remain on-topic
• Recognition of own weaknesses
• Solo and co-op problem solving