collapsing rows of a cell array into a single cell
10 views (last 30 days)
Show older comments
I have a 312x3 cell called 'data'. In the first column there are 312 rows of different x-values, the second column there are 312 rows of different y-values, and in the third column there are 312 rows of t-values. I want to collapse all the rows of each column into a single cell, such that all the x-values are in a single cell (first column), all the y-values are in a single cell (second column), and all the t-values are in a single cell (third column). For instance, if I started with the following 6x4 cell array called Data:
Data =
0.935 4 24 0.07
0.759 5 74 0.01
0.681 2 21 0.09
0.823 1 16 0.06
0.894 3 7 0.01
0.953 5 67 0.03
I can't figure out how to transform this into the following 1x4 cell array (Data2)
Data2 =
([0.935 0.759 0.681 0.823 0.894 0.953] [4 5 2 1 3 5] [24 74 21 16 7 67] [0.07 0.01 0.09 0.06 0.01 0.03], :)
Is there a piece of code that can do this?
I hope this makes sense! Thanks for the help.
Best wishes,
Billy
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!