Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski 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
Joined
Sep 11, 2008
Messages
2
Location
US
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.
 
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

Back
Top