Average of multiple cell arrays
    6 Ansichten (letzte 30 Tage)
  
       Ältere Kommentare anzeigen
    
    Christine
 am 3 Jun. 2020
  
    
    
    
    
    Kommentiert: Christoph Thorwartl
 am 24 Jun. 2021
            Hi all. I've figured out how to get the average of multiple cell arrays so that the end product is a 1x22051 complex double. However, is there a code that could simplify this? I have over 50 cell arrays, but shortened it for this example.
avg_ydft = (ydft{1,1}+ydft{1,2}+ydft{1,3}+ydft{1,4}+ydft{1,5}+ydft{1,6}+ydft{1,7}+ydft{1,8})/8;
0 Kommentare
Akzeptierte Antwort
  Stephen23
      
      
 am 3 Jun. 2020
        
      Bearbeitet: Stephen23
      
      
 am 3 Jun. 2020
  
      Assuming that each cell contains a 1x22051 vector (i.e. they are all the same size):
avg_ydft = mean(cat(3,ydft{:}),3)
3 Kommentare
  Christoph Thorwartl
 am 23 Jun. 2021
				I get the following error. How could I rewrite the code?
Error using var (line 197)
W must be a vector of nonnegative weights, or a scalar 0 or 1.
Thank you and best regards,
Christoph 
  Christoph Thorwartl
 am 24 Jun. 2021
				I have asked the question separately (https://www.mathworks.com/matlabcentral/answers/864270-standard-deviation-of-multiple-cell-arrays).
This modified code also works for the standard deviation: 
SD = std(cat(3,M{:}),[],3)
Weitere Antworten (0)
Siehe auch
Kategorien
				Mehr zu Operators and Elementary Operations finden Sie in Help Center und File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


