Answer to Question #209528 in MatLAB for mulalo

Question #209528

Create a row vector which contains the sum of each column in a matrix of unknown dimensions – use the matrix shown below as your test data: [2 -5 6 7; -4 8 -5 6] Display the resulting row vector as follows: The sum of column 1 is -2.00 … The sum of column 4 is 13.00 


1
Expert's answer
2021-06-22T09:45:33-0400
A = [2 -5 6 7; -4 8 -5 6];
v = sum(A);
for i=1:length(v)
    fprintf('The sum of column %d is %.2f\n', i, v(i));
end

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS