问题
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