combine cell and multidemensional matrix

1 次查看(过去 30 天)
Hi. I have a 5x1 cell with names in it ("names") and a 5x1 cell with usage numbers in it ("usage"). Within the "usage" cells are yx4 double values that all differ in length as different time periods are covered. i.e. if I open the first cell within "usage" it is 77x4, the second cell is 140x4, the third 79x4... like so...
Usage
77x4 double
140x4 double
79x4 double
77x4 double
52x4 double
Names
John
Jim
Sam
Tim
Tom
I am trying to make a matrix that has lists of all the values within "usage", but with the name next to each observation. Is there a simple way to achieve this?
  4 个评论
James Tursa
James Tursa 2017-4-5
You can't combine numeric and character data in a double matrix. For that you would need a cell array or a table. E.g.,
result(1,1) = {[1 2 3 4],'John'}
result(2,1) = {[5 6 7 8],'John'}
:
etc
In other words, the first column of the cell array are the rows of your Usage matrices and the second column of the cell array would be the names. Is that acceptable?

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrices and Arrays 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by