cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

getting the mean of a submatrix

JasonC
1-Visitor

getting the mean of a submatrix

Hello all,

I have a matrix of vectors. I plotted one of the vectors below.

Can someone tell me the "proper" or most elegant way of calculating the mean of the values?
I have a mild flu and it's hard for me to concentrate, so I thought someone could nudge me along

TIA

powers.PNG

10 REPLIES 10
Werner_E
25-Diamond I
(To:JasonC)

Its not absolutely clear to me which mean of which values you are looking for.

Maybe you can setup a simplified sheet and post it here and tell us the desired result.

MJG
18-Opal
18-Opal
(To:JasonC)

Here are a few possibilities:

JasonC
1-Visitor
(To:MJG)

I have a 1x7 matrix of 10x1 matrices. (below)
I'd like the mean of say, the 5th element (cue Mila Jovovich ) of the 10-element matrices.

matrix.png

LucMeekes
23-Emerald III
(To:JasonC)

This should do what you want, and possibly more:

Success!

Luc

Werner_E
25-Diamond I
(To:JasonC)

Sorry, still not sure

Jason Cuadra wrote:

I have a 1x7 matrix of 10x1 matrices. (below)
I'd like the mean of say, the 5th element (cue Mila Jovovich ) of the 10-element matrices.

Does this mean that you want to get the mean of the fith 10 x 1 vector or would you like the mean of the seven values which are at the 5th position of each 10 x 1 matrix.

The first would be easy by just using mean(data[0,5).

JasonC
1-Visitor
(To:Werner_E)

I want the mean of the seven values which are at the 5th position of each 10 x 1 matrix. 

Werner_E
25-Diamond I
(To:JasonC)

Jason Cuadra wrote:

I want the mean of the seven values which are at the 5th position of each 10 x 1 matrix. 

So I guess you already have the solution - see below 😉

Werner_E
25-Diamond I
(To:JasonC)

Here are some ways to calculate the one or the other mean value:

JasonC
1-Visitor
(To:JasonC)

OK guys, it seems that there isn't a one-liner way to do what I need; a procedure needs to be written.


Thanks ll

Fred_Kohlhepp
23-Emerald I
(To:JasonC)

I can do it in two steps:

Announcements

Top Tags