删除单元格数组列 [英] Delete a cell array column
本文介绍了删除单元格数组列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
将简单值放入单元格数组以进行测试.
Placed simple values into the cell array for testing.
model{1,1}=1;model{1,2}=2;model{1,3}=3;
model{2,1}=4;model{2,2}=5;model{2,3}=6;
i=2;//I want to remove the second column
temp={ model{:,1:i-1} model{:,i+1:size(model,2)} }
我想要这样的结果:
temp =
temp =
[1] [3]
[4] [6]
但是我得到了:
temp =
temp =
[1] [4] [3] [6]
我该如何正确处理?
ps:对于从事单元阵列研究的任何人,有一种很好的技术可以在此处追加.
p.s: for anyone working on Cell Arrays, there's a nice technique for appending here.
推荐答案
您可以使用()-寻址重塑或删除单元格本身.
You can reshape or delete the cells themselves using ()-addressing.
model(:,2) = [];
这篇关于删除单元格数组列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文