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?

 Akzeptierte Antwort

Cedric
Cedric am 16 Okt. 2017

1 Stimme

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

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by