Question: Write a function called multiSum(A). This particular function should take in a N M array, A, and return four results: A 1 M vector with

Write a function called multiSum(A). This particular function should take in a N M array, A, and return four results:

 A 1  M vector with the sum of the columns, A N  1 vector with the sum of the rows, and Two numbers containing the sums of the two diagonals, the major diagonal first. 

For example:

 columnSum([1 2 3; 4 5 6; 7 8 9]) should return [12 15 18], [6 15 24]', 15 and 15 columnSum([0 2 3; 4 0 6; 7 8 0]) should return [11 10 9], [5 10 15]', 0 and 10 columnSum(eye[5,5]) should return [1 1 1 1 1], [1 1 1 1 1]', 5 and 1 columnSum([]) should return [], [], 0 and 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!