how can i use averaging from excel file

I have two columns F and M in Excel.In F column i have repetetive numbers and in M column i have different numbers.For each Group of numbers in F i want a average in M Column. for example :F= 111 22 33 444 and M= abc de fh ijk. at the end i must have: F=1 2 3 4, M=(a+b+c)/3 (d+e)/2 (f+h)/2 (i+j+k)/3

 Réponse acceptée

Jan
Jan le 18 Mai 2017
Modifié(e) : Jan le 18 Mai 2017
Does this problem concern Excel? Are you able to import the data already to a matrix? If not, please ask for importing Excel files explicitely.
F = [1 1 1 2 2 3 3 4 4 4];
M = rand(size(F));
[~, FF] = findgroups(F.');
MM = splitapply(@mean, M.', F.')

2 commentaires

mehdi moudi
mehdi moudi le 19 Mai 2017
Hi, tnx for your answer.I describe it again
Jan
Jan le 19 Mai 2017
@mehdi moudi: This exactly what the suggested code should do. Is your problem solved?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Read, Write, and Modify Image dans Centre d'aide et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by