Unbalanced brackets or brackets

I assign the command as follows:

[r,~]=size(alternative) 

The problem I get: Unbalanced or unexpected brackets or brackets.

Does anyone know why? I have an alternative size of 252x6

thanks

+4
source share
1 answer

You are running an older version of Matlab (older than R2009b).
Using ~ as an unattached argument is a relatively new Matlab function.

Use instead:

 [r, ignore] = size( alternative ); 

See How to gracefully ignore some MATLAB function return values? for other methods to accomplish what you are trying.

PS
In particular, for size you can specify the size you are interested in as an input argument:

 r = size( alternative, 1 ); % get only the number of rows 
+5
source

Source: https://habr.com/ru/post/1485392/


All Articles