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

 채택된 답변

0 개 추천

给你个示例,看懂了就会了
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개)

카테고리

도움말 센터File Exchange에서 MATLAB 快速入门에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!