In: Computer Science
MATLAB Code :
Matrix2 = ones(10,10) % creating a matrix of 10x10 of
ones
Matrix2Sum = reshape(cumsum(Matrix2),1,[]) % storing the cumulative
sum or all entries in Matrix2 And then converting Matrix2Sum to row
vector
size(Matrix2Sum) % printing the length of the vector
Matrix2Sum
Code Screenshot :
Output :