Hello,
How can I sum all the elements in an undefined matrix(the built-in homeworktester puts in its A) without using the sum-function?
This is what I've gotten so far. The result I get is the same element in the matrix multiplied with the numel(A).
function summa = summa_element(A)[m,n]=size(A)a=A(m,n)summa=0;for i=1:numel(A)summa= summa + aendend
Best Answer