Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

This question already has an answer here:

i have the following question: Let us assume we have the following list:

list={1.1,1.2,1.0,2.1,2.2,2,0,3.1,3.0,3.2}

I need a function that always takes three values of this list and put the Mean of these three values into a new list so I want to end with:

list2={1.1,2.1,3.1}

How can i do this easily?

Thank you in advance

Edit: Thank you very much

share|improve this question

marked as duplicate by Mr.Wizard May 30 at 9:24

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1  
If you've received a satisfactory answer to your question, you don't have to edit your post to say thank you, you should accept the answer instead. –  Rahul May 30 at 8:42
1  
And you should upvote any answer you like, too. –  Yves Klett May 30 at 8:45
1  
I changed the marked duplicate to one that truly is a duplicate. Please also see the questions linked in my answer there. –  Mr.Wizard May 30 at 9:30

1 Answer 1

Mean/@Partition[list,3]

This partitions the list into a list of lists with three elements each, and then finds the mean of each list and stores the results in a list. This will only work for lists of length 3, 6, etc.

In the example you've given, there's a stray $0$ which I think you may have missed.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.