Mean of a field of a struct
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
As seen in image below, I have a struct of 5 fields. I need to compute the avarege of the HV3, HV5, HV7 and thd in 1st row, then in the second row and so on seperately.. Have a nice weekend..
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/359902/image.jpeg)
0 commentaires
Réponses (2)
Ameer Hamza
le 13 Sep 2020
Try something like this
S_new = rmfield(S, 'name');
S_out = arrayfun(@(s) structfun(@mean, s, 'uni', 0), S_new);
[S_out.name] = S.name;
8 commentaires
Voir également
Catégories
En savoir plus sur Data Import and Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!