Reputation: 444
I have a problem in MATLAB. I have a NxM logical array called L
but if I do dim(L)
I get:
Undefined function or method 'dim' for input arguments of type 'logical'
size
doesn't work either. length
works but gives me only the number of columns and not the rows.
The weird thing is that in the Matlab workspace it is correctly shown as an NxM logical array.
Does anyone know how I can get the amount of rows and columns of a logical array?
Thanks in advance.
Upvotes: 0
Views: 879
Reputation: 74930
If you want both the number of rows and colums, size
is your best choice:
[nRows,nCols] = size(L)
If this fails, use clear size
first, since you may accidentially have a variable of the same name in your workspace.
Upvotes: 2