Reputation: 465
I have a working MATLAB code, which works fine on another machine, but when I run it on my own computer it detects the foloowing syntax error:
Expression or statement is incorrect--possibly unbalanced (, {, or [.
This is my code:
[~,x] = min(A);
Upvotes: 3
Views: 1147
Reputation: 12486
What version of MATLAB are you using?
The ~
syntax for discarding unwanted return values was only introduced in R2009b.
EDIT: Had 2008a.
Upvotes: 5
Reputation: 5595
You have an older version of MATLAB that doesn't recognize the "~" syntax. Change the ~ to "junk" or some other variable name to remind yourself you don't care about the result and the code should run fine.
Or update your MATLAB to the latest version.
Upvotes: 5