parse error at '=': usage might be invalid matlab syntax
12 views (last 30 days)
Show older comments
Dear colleagues,
I wrote the following code for a function, but when I run it, there is an error at Command Window that tells me the following message:
>> Metodo_Caracteristicas_2
Error: File: Metodo_Caracteristicas_2.m Line: 14 Column: 37
The expression to the left of the equals sign is not a valid target for an assignment.
I will would greatly appreciate who helps me, thank you.

9 Comments
Walter Roberson
on 4 Mar 2020
Well, that kind of line with an expression and then "=" and then another expression, is valid in C only to the extent that the person is coding an inline assignment statement in a confusing manner. For example in C,
A + B = 1 + C;
is valid and is to be interpreted as:
calculate or retrieve A and pull it into memory
assign 1 to variable B and pull the resulting value into memory
do the addition of those two items in memory, leaving the result in memory
calculate or retrieve C and pull the resulting value into memory
do the addition of those two items in memory, leaving the result in memory
discard the result in memory
In your case, it would be P_I[i][n] that would be assigned into in both lines. It is unlikely that that would be what you would want to do.
If you can rewrite the lines the way you would code them in C, there is a good chance we could tell you how they would then be coded in MATLAB.
Answers (0)
See Also
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!