“Flattening” a cell array

孤街醉人 提交于 2019-12-19 05:21:06

问题


I have created a function which takes vectors for input variables and returns a cell array for each set of inputs. The final output variable (out) seems to consist of a 2x1 cell containing two 1x5 cells. I have provided a screenshot of this below:

I am just trying to figure out how to flatten the cell array (out) to be a 2x5 cell array.


回答1:


One way to achieve that would be -

vertcat(cell_array1{:})



回答2:


If your cell has unequal number of elements in each row , maybe this might work better

vector=[cell_array{:}]


来源:https://stackoverflow.com/questions/23334819/flattening-a-cell-array

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