1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Matlab Missing Matlab operator

  1. Mar 16, 2009 #1
    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

    Code (Text):
    counter =1;
    while (counter<5)
            cur=imread('salam(' int2str(counter) ').jpg');
    but i am getting the following error

    Code (Text):
    ???         cur=imread('salam(' int2str(counter) ').jpg');
    Error: Missing MATLAB operator.
    Last edited: Mar 16, 2009
  2. jcsd
  3. Mar 16, 2009 #2
    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
    http://matlabdatamining.blogspot.com/" [Broken]
    Last edited by a moderator: May 4, 2017
  4. Mar 16, 2009 #3
    Re: Matlab " Missing Matlab operator"

    Thank you very much Predictor, it is working now :)
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook