How to take an average every four columns?
    6 次查看(过去 30 天)
  
       显示 更早的评论
    
Hi, I have seen similar questions but I am getting stuck altering the code for what I want. I have a matrix of (64 x 18144), each row is a met station and each column is a 15 minute data measurement - I want to convert this to hourly data for each station - so I want to have an output matrix of (64 x 4536). I have seen some solutions but I don't have the 'tools' they require. Any help/ideas would be very much appreciated! :)
采纳的回答
  James Tursa
      
      
 2018-2-13
        x = your 64x1844 matrix
result = reshape(mean(reshape(x.',4,[])),size(x,2)/4,[]).';
0 个评论
更多回答(1 个)
  Andrei Bobrov
      
      
 2018-2-13
        
      编辑:Andrei Bobrov
      
      
 2018-2-13
  
      A - your matrix (64 x 18144)
B = A.';
[m,n] = size(B);
t = minutes((0:m)'*15);
Tb = array2timetable(B,'RowTimes',t);
Tout = retime(Tb,'hourly','mean');
out = Tout{:,:}';
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


