clear; clc;
a = [1,2,3;4,5,6];
b =[1,2;3,4;5,6];

% no of elements in longest dimension of a matrix. x  3 , y  3
x = length(a);
y = length(b);

%returns the size of matrix 'a'. z [2,3]
z = size(a);

% reshapes the matrix 'a' with with 1 row and 6 columns. l [1,2,3,4,5,6]
l = reshape(a,1,6);

k = [1,0,0,0;0,2,0,0;0,0,3,0;0,0,0,4];

% returns a column matrix with diagonal elements of another matrix. dia [1;2;3;4]
dia = diag(k);

results matching ""

    No results matching ""