Nested cells matlab

a 夏天 提交于 2019-12-12 02:15:44

问题


I have a 73 x 1 cell, each of those cells contains a 16 x 1 cell and each of those cells is an image. Is there an easy way I can convert this into one big array of cells containing only the images? Many thanks.


回答1:


If C is your cell, use B = [C{:}] to create a 16×73 cell B with every column one of your original 16×1 cell elements. This works, because C{:} accesses every element in cell C and the brackets ([ ]) group all these elements into one array again. This is possible, because every element in C is of the same type and size.

Use B = B(:) to get a 1168×1 cell (73*16=1168), if you want. Either way, B{n} accesses the n-th image.



来源:https://stackoverflow.com/questions/31588250/nested-cells-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!