size function - dimensions of matrixfor the


Size function - Dimensions of matrix:

For the matrix mat shown next, it has three rows and two columns, therefore the size is 3 × 2. The length is the larger dimension that is 3.

>> mat = [1:3; 5:7]'

mat =

1     5

2     6

3     7

>> size(mat)

ans =

3    2

>> length(mat)

ans =

3

>> [r  c] = size(mat)

r = 3

c = 2

The size function returns two values; therefore in order to capture these values in separate variables we put a vector of two variables on the left of the assignment. The variable r stores the initial value returned, that is the number of rows, and c stores the number of columns.

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: size function - dimensions of matrixfor the
Reference No:- TGS0174732

Expected delivery within 24 Hours