combine cell and multidemensional matrix

1 Ansicht (letzte 30 Tage)
matla6123
matla6123 am 5 Apr. 2017
Kommentiert: matla6123 am 5 Apr. 2017
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 Kommentare
James Tursa
James Tursa am 5 Apr. 2017
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 am 5 Apr. 2017
ok thanks for the help.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by