MATLAB: Indexing entry of a matrix result

matrix

A is an MxN matrix. To get the number of columns of A I can do the following:
s = size(A);
ncol = s(2);
How can I construct a direct expression avoiding the intermediary variable s?

Best Answer

[nRows, nCols] = size( A ) ;
if you don't need nRows:
[~, nCols] = size( A ) ;