nanmean of a variable that should meet 2 conditions
1 次查看(过去 30 天)
显示 更早的评论
I have a matrix with time observations that are labelled as 1 till 92 for every firm in the matrix. S, assume time 1 refers to march 1996, then every firm in the matrix has a time 1 that refers to march 1996. I tried to take the average of each time period in the matrix by running the following
for m=1:92
B(m:92:end,1)=nanmean(A(m:92:end,1));
end
the issue is that I have different size groups that are equals to 1(large firms), 2(medium size) and 3 (small) and the data is stored in A second column
how can i take the average of each time period for each size group? (i.e when A(i,1)=1 and A(i,2)=3 I want B (i,1) to be the nanmean of the first column of A that have time 1 and size 3 where i is the row number.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!