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?

采纳的回答

Walter Roberson
Walter Roberson 2013-12-16
[A(:,1:2), B(:), A(:,3:end)]
  3 个评论
Walter Roberson
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 CenterFile Exchange 中查找有关 Resizing and Reshaping Matrices 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by