Adding a column in particular location
11 次查看(过去 30 天)
显示 更早的评论
HI,
I have a metrics and I want to add a column with Title and values. I can create that column and do horzcat but that can add a column first or last. I want to add as a 3rd column. How do i do it?
0 个评论
采纳的回答
Walter Roberson
2013-12-16
[A(:,1:2), B(:), A(:,3:end)]
3 个评论
Walter Roberson
2013-12-16
Possibly if you use a "table" you could do that.
Otherwise, you could use ismember() of each column title you wish to refer to, comparing to the cell array of strings of column titles. With the two-output version if ismember() that would give you the numeric column indices that you could then re-arrange.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!