introduction to programming with matlab - Vanderbilt University week-7 assignment 1 solutions


 for-loop Practice


These solutions are for reference only.

It is recommended that you should solve the assignment and quiz by yourself honestly then only it makes sense to complete the course.

but if you cant figure out some part of it than you can refer these solutions

make sure you understand the solution  

dont just copy paste it

-----------------------------------------


function s = halfsum(M)

   [n, m] = size(M);

   s = 0;

   for row = 1:n

       for column = row:m

           s = s + M(row, column);

       end

   end

end

main course : https://www.coursera.org/learn/matlab

darkmode