Takin the mean of data in tables
    5 vues (au cours des 30 derniers jours)
  
       Afficher commentaires plus anciens
    
    Sebastian Daneli
 le 16 Nov 2021
  
    
    
    
    
    Commenté : Sebastian Daneli
 le 16 Nov 2021
            I have his table
X1=[9 6 9;3 2 7];
X2=[0 2;4 0];
X3=[3 1 2; 8 9 7];
X=table(X1,X2,X3)
And I need to take the mean of the rows in each entry, which would give me 
m1=[8 4]', m2=[1 2]' and m3=[2 8]'. 
Can this be done efficiently?
0 commentaires
Réponse acceptée
  KSSV
      
      
 le 16 Nov 2021
        X1=[9 6 9;3 2 7];
X2=[0 2;4 0];
X3=[3 1 2; 8 9 7];
X=table(X1,X2,X3) ;
[m,n] = size(X) ; 
iwant = zeros(2,n) ;
for i = 1:n
  iwant(:,i) = mean(X.(i),2) ;
end
iwant
3 commentaires
Plus de réponses (0)
Voir également
Catégories
				En savoir plus sur Tables 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!