Averaging over certain elements in an array ?
Mostra commenti meno recenti
Hi, I have the following array :
a=[1,1,1;1,2,1;1,3,1;1,7,1;1,8,1;2,4,2;4,5,2;4,6,2;3,3,3;4,5,3;5,6,4;];
rn = unique(a(:,3));
I would like to average all the a(:,1) & a(:,2) such that a(:,3) belongs to elements of rn, and store it another array, say C. For example, in this case, I would like to average C(1,1)=mean(a(1:5,1)), C(1,2)=mean(a(1:5,2)) , C(2,1)=mean(a(6:8,1)), C(2,2)=mean(a(6:8,2)) ... and so on
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Language Fundamentals in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!