Summing Rows and Columns - MATLAB Cody - MATLAB Central

Problem 45177. Summing Rows and Columns

Difficulty:Rate

Create a matrix y of size (n+1) whose last column's elements are the summation of the elements of all the other columns and last row's elements are the summation of the elements of all the other rows; where 'n' is the size of the input matrix 'x'.

For example

   x = [ 1  2  3
         4  5  6
         7  8  9 ]

then

   y = [ 1  2  3  6 
         4  5  6 15
         7  8  9 24
        12 15 18 45 ]

Solution Stats

58.33% Correct | 41.67% Incorrect
Last Solution submitted on May 24, 2024

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers55

Suggested Problems

More from this Author165

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!