3

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);
1
  • I am using Matlab 7.8.0 R2009a 32bit Commented Apr 23, 2012 at 14:28

2 Answers 2

5

What version of MATLAB are you using?

The ~ syntax for discarding unwanted return values was only introduced in R2009b.

EDIT: Had 2008a.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your Answer. but I am using Matlab 7.8.0 R2009a 32bit
I mis-spoke; that syntax was only introduced in R2009b.. So this is indeed the problem. ;)
5

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.