how to count row and column of a matrix

865 views (last 30 days)
eri
eri on 14 Dec 2011
Commented: Alexander on 20 Jan 2025 at 21:48
if i have a big matrix and i don't know its size, how to find out its size? and how to save it as variable?

Accepted Answer

the cyclist
the cyclist on 14 Dec 2011
[m,n] = size(A)
  4 Comments

Sign in to comment.

More Answers (2)

Md. Kawsar Ahmed Asif
Md. Kawsar Ahmed Asif on 13 Dec 2017
Edited: Md. Kawsar Ahmed Asif on 13 Dec 2017
[rownum,colnum]=size(A)
Where 'A' is a mxn matrix.

Anurag Pratap Singh
Anurag Pratap Singh on 25 Jun 2020
Hii Eri
To know the size of a matrix you can use the size function and pass your matrix in it
[NumRows NumCols]=size(your_matrix);
The first output is the Number of rows and second the number of columns
Thank you

Categories

Find more on Creating and Concatenating Matrices 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!