元胞数组,重组??循环。

2 次查看(过去 30 天)
想把个数相同的cell合并了,例如,图中,1,2,3,4,6,7,8行那些都只有一个数,就想把它们合并起来,然后两个元素的也合并,例如行数是5,17,18的。
不知道该怎么写代码...

采纳的回答

百家乐真人网址【微8785092】
给你个示例,看懂了就会了
cell = {{1},{2},{3},{4},{5,6}};
Out = {};
kk = 1
for ii = 1:length(cell)
if size(cell{ii})==1
Out(kk) = cell{ii};
kk = kk+1;
end
end

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 快速入门 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!