How to Find the MATLAB Number of Rows


MATLAB is a technical computing program used in the scientific and engineering community, which require automated and efficient data handling and processing on high-dimensioned data sets. These data are often contained in matrix form where each element of the matrix has its own unique location represented by the row and column that it coincides. Many functions in MATLAB required for automated data processing require the dimensions of the matrix.

  • Clear all of the functions and saved variables from the workspace by typing "clear all" in the command window.

  • Create a random three-row by five-column matrix by using the command "test=rand(3,5)."

  • Determine the rows and columns of the matrix using the command "[r c]=size(test)" where the output will be the number of rows, three, within the matrix test and c the number of columns, five. R and c will be saved as variables within the active workspace and can be used for future calculations that require the size of the matrix.

Tips & Warnings

  • Another way of determining the matrix dimensions is to the use the "length(matrix)" command where matrix is the name of the matrix in question. This will output the highest dimension of the matrix, therefore only a row or column dimension will be given.


  • Photo Credit Stockbyte/Stockbyte/Getty Images
Promoted By Zergnet


You May Also Like

Related Searches

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!