Adding a column in particular location

11 visualizaciones (últimos 30 días)
Neesha
Neesha el 16 de Dic. de 2013
Comentada: Neesha el 16 de Dic. de 2013
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?

Respuesta aceptada

Walter Roberson
Walter Roberson el 16 de Dic. de 2013
[A(:,1:2), B(:), A(:,3:end)]
  3 comentarios
Walter Roberson
Walter Roberson el 16 de Dic. de 2013
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.
Neesha
Neesha el 16 de Dic. de 2013
Ok, great, thanks

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Resizing and Reshaping Matrices en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by