indexing entry of a matrix result

2 views (last 30 days)
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?

Accepted Answer

Cedric
Cedric on 16 Oct 2017
[nRows, nCols] = size( A ) ;
if you don't need nRows:
[~, nCols] = size( A ) ;

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!