dimensions - matrixthe size and length functions


Dimensions - matrix:

The size and length functions in the MATLAB are used to find array dimensions. Length function returns the number of elements in the vector. The size function returns the number of rows & columns in a matrix. For matrix, the length function will return either the number of rows or the number of columns, whichever is the maximum. For illustration, the following vector, vec, has 4 elements therefore its length is 4. It is a row vector; hence, the size is 1 × 4.

>> vec = -2:1

vec =

-2  -1  0  1

>> length(vec)

ans =

4

>> size(vec)

ans =

1  4

Request for Solution File

Ask an Expert for Answer!!
Applications of MATLAB: dimensions - matrixthe size and length functions
Reference No:- TGS0174731

Expected delivery within 24 Hours