combine cell and multidemensional matrix
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
James Tursa
el 5 de Abr. de 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?
Respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!