Jump to content

Best Way to Average Array Rows with Same Value in First Column


Recommended Posts

An example of what I'm doing:

 

Given:

[1,2,3;

2,2,2;

2,4,4;

3,1,1;

3,3,3]

 

Output:

[1,2,3;

2,3,3;

3,2,2]

 

So that the output array has unique values in the first column, the values in the other columns being the average of the rows with the same value in the first column.

 

The code I have right now is this:

post-30070-0-09855900-1361282894_thumb.p

 

Is there a simpler way to do this?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.