size() Function
size() function returns two values specifying the number of rows and columns of any matrix.
For example:
>> A=[1 2 3 7 4; 4 5 8 4 -3; 0 5 9 0 -3; 2 1 7 3 0 ];
>> [m n]=size(A)
m =
4
n =
5
end Function
MATLAB provides a special function named end that is very useful for creating array subscripts. The end function returns the highest value taken by the subscript in vector or matrix.
For example:
>> B =
[8 7 6 5 4 3 2 1];
>> B(5 : end)
ans =
4 3 2 1
We can write 3*4 matrix in MATLAB as follows:
>> A =
[1 2 3 4; 5 6 7 8; 9 10 11 12]
A =
1 2 3 4
5 6 7 8
9 10 11 12
>> A(2: end, 2:end)
ans =
6 7 8
10 11 12