How to print out a cell array inside a cell array
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Garrett Linton
el 3 de Dic. de 2019
Comentada: dpb
el 4 de Dic. de 2019
teampick =
1×4 cell array
{1×4 cell} {1×4 cell} {1×4 cell} {1×4 cell}
0 comentarios
Respuesta aceptada
dpb
el 3 de Dic. de 2019
How did you manage to get that so deeply nested? Let's see the code that generated the array and work on it...
But, to answer the question, one just keeps on dereferencing layer after layer...
>> v={{{rand(1,1)},{rand(1,1)}}} % WOW! Why would one do this????
v =
1×1 cell array
{1×2 cell}
>> v{1}{1}
ans =
1×1 cell array
{[0.4720]}
>> v{1}{1}{1}
ans =
0.4720
>>
2 comentarios
dpb
el 4 de Dic. de 2019
Missing the functions being called, but when you start with cell(), then don't use the curlies "{}" for the array addressing but () to avoid inserting the cell into the cell array.
General rule is to only use cell addressing at the lowest level needed to store disparate data types; the cell array itself is just an array.
Alternatively, instead of cell arrays, consider struct with named fields to hold the disparate content of each team...the positions could be the field names.
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Types 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!