how to remove an entire column in a cell array
46 次查看(过去 30 天)
显示 更早的评论
I have a cell array of ca and I need to be able to remove an entire column. So far I am able to delete the last column 'Final', but not sure how to delete the middle columns since its a mixed cell array of char and doubles.
ca = {'Name','Test1','Test2','Test3','Final';
'A', 70 , 80 , 100, 99;
'B', 30 , 90, 95, 90;
'C', 100, 70, 85, 90}
newCa = ca(:,2:end)
0 个评论
采纳的回答
Voss
2022-10-26
ca = {'Name','Test1','Test2','Test3','Final';
'A', 70 , 80 , 100, 99;
'B', 30 , 90, 95, 90;
'C', 100, 70, 85, 90};
% delete the third column, say:
ca(:,3) = []
0 个评论
更多回答(1 个)
David Hill
2022-10-26
ca = {'Name','Test1','Test2','Test3','Final';
'A', 70 , 80 , 100, 99;
'B', 30 , 90, 95, 90;
'C', 100, 70, 85, 90};
newCa=ca;newCa(:,3)=[]
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Multidimensional Arrays 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!