combine cell and multidemensional matrix

1 回表示 (過去 30 日間)
matla6123
matla6123 2017 年 4 月 5 日
コメント済み: matla6123 2017 年 4 月 5 日
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?
matla6123
matla6123 2017 年 4 月 5 日
ok thanks for the help.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by