reshaping tables and calculating combination of differences between variables
1 次查看(过去 30 天)
显示 更早的评论
Hi all,
I would like to reshape the following table
Area time rates
A1 2008 13
A1 2009 12
A2 2008 11
A2 2009 9
A3 2008 7
A3 2009 13
A4 2008 6
A4 2009 7
A5 2008 9
A5 2009 5
to this one
Time A1 Aa2 A3 A4 A5
2008 13 11 7 6 9
2009 12 9 13 7 8
and then extend the table with the following colums
time DA12 DA13 DA14 DA15 DA23 DA24 DA25 DA34 DA35 DA45
2008
2009
Where DA12=difference between area 1 and area 2. Similarly for the rest. Is it possible to write a code that will calculate all the combinations of the differences between these areas "quickly"because i have 50 such areas across a long period of time.
thanks in advance
3 个评论
Ory
2016-10-12
I have the same question, as far as the 1st part is concerned: how do you pivot data in Matlab without using for loops? In R one can do it using the Reshape package for example, where one can 'melt' the dataset and 'cast' it into a new shape.
回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!