Matlab Missing Matlab operator

In summary, the conversation was about an individual who was new to Matlab and was having trouble reading multiple images. They were trying to use the imread function but were encountering an error. The solution was to concatenate the components of the file name using square brackets.
  • #1
Salam
2
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
  • #2


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:
  • #3


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

FAQ: Matlab Missing Matlab operator

What is the meaning of "Matlab Missing Matlab operator"?

When you receive an error message saying "Missing Matlab operator", it means that there is a missing operator in your Matlab code. An operator is a symbol used to perform mathematical operations, such as +, -, *, or /. This error usually occurs when you forget to include an operator between two variables or values in your code.

Why am I getting the "Missing Matlab operator" error?

This error is caused by a mistake in your code where an operator is missing. This could be due to a typo or forgetting to include an operator between two values. It can also occur when using an incorrect operator or using an operator in the wrong context.

How do I fix the "Missing Matlab operator" error?

To fix this error, you need to find where the missing operator is in your code and add it in the correct place. Carefully check your code for any typos or missing operators. Make sure that all operators are used in the correct context and that you are using the correct operator for the desired operation.

Can a single missing operator cause the "Missing Matlab operator" error?

Yes, a single missing operator can cause this error. Even if your code is correct except for one missing operator, you will still receive this error. It is important to carefully check your code for any missing operators, even if it seems like a small mistake.

How can I prevent the "Missing Matlab operator" error?

To prevent this error, it is important to carefully check your code for any missing operators before running it. You can also use debugging tools in Matlab to help you identify and fix any issues with missing operators. It is also helpful to organize your code and use clear and consistent variable names to avoid confusion and typos.

Similar threads

Replies
3
Views
1K
Replies
1
Views
1K
Replies
10
Views
2K
Replies
6
Views
2K
Replies
3
Views
2K
Replies
3
Views
1K
Replies
1
Views
1K
Back
Top