×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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.

RE: Create a matrix of averages of a row of a 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: Eng-Tips.com Forum Policies

RE: Create a matrix of averages of a row of a previous matrix

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

RE: Create a matrix of averages of a row of a previous matrix

(OP)
thanks for that file jghrist!  That did exactly it!  Thanks for the quick response to all of you.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources