Matlab syntax error on [~, ...]

I have a working MATLAB code that works fine on another machine, but when I run it on my own computer, it detects the following syntax error:

Expression or statement is incorrect--possibly unbalanced (, {, or [.

This is my code:

    [~,x] = min(A);
+3
source share
2 answers

What version of MATLAB are you using?

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

EDIT: Was 2008a.

+5
source

You have an older version of MATLAB installed that does not recognize the syntax "~". Change ~ to "garbage" or some other variable name to remind yourself that you do not need the result, and the code should work fine.

MATLAB .

+5

All Articles