Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Summing Matrix columns

Subject: Summing Matrix columns

From: Barry

Date: 14 Aug, 2010 11:46:03

Message: 1 of 2

I need to sum matrix columns it is a 48 x 365
and distribute that sum evenly over the first 20 rows and have the next 28 0's for each column. so as to end up with a 48 x 365.

a b c
a b c
a b c
. . .
. . .
. . .
0 0 0
0 0 0
0 0 0
. . .
. . .
. . .

Subject: Summing Matrix columns

From: Matt J

Date: 14 Aug, 2010 19:10:09

Message: 2 of 2

"Barry " <barryoconnell2@gmail.com> wrote in message <i45vlr$oi8$1@fred.mathworks.com>...
> I need to sum matrix columns it is a 48 x 365
> and distribute that sum evenly over the first 20 rows and have the next 28 0's for each column. so as to end up with a 48 x 365.
>

A(1:20,:)= ones(20,1)*sum(A)/20;
A(21:end,:)=0;

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us