Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a matrix of averages of a row of a previous matrix 1

Status
Not open for further replies.

dylansylvester

Mechanical
Sep 11, 2008
2
I have a 18x3 matrix. The three columns represent three separate trials.

What I am trying to do is take the mean of the first row of each column, and put that value into a new matrix, then do that for each subsequent row. So ultimately I would end up with an 18x1 matrix with each value equal to the average of the corresponding row in the previous matrix.
 
Replies continue below

Recommended for you

So, what exactly are you having trouble with? You have indices for the input and output matrices:

i := 0;17
out[i := in[i,0 + in[i,1 + in[i,2

TTFN

FAQ731-376
 
The other way is to first transpose the matrix [ctrl+!] then use the colum extract [ctrl+^] and the mean() to make the average more general.

Philip
 
thanks for that file jghrist! That did exactly it! Thanks for the quick response to all of you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor