登录论坛

查看完整版本 : 如何将64 x 64单元合并为1 x 1单元


poster
2019-12-10, 20:30
我有一个64 x 64单元,如何将其合并回1 x 1单元?每个单元格是8 x 8的两倍。



回答:

使用cell2mat (http://www.mathworks.com/access/helpdesk/help/techdoc/ref/cell2mat.html) 。

%# create a sample 2-by-2 cell array c = cell(2); %# put a 3-by-3 double into each cell [c{:}] = deal(magic(3)); %# convert to one big 6-by-6 array m = cell2mat(c); 编辑

如果您希望结果再次成为单元格,请运行

m = {cell2mat(c)};

更多&回答... (https://stackoverflow.com/questions/2612870)