How can I change the data type of a column?

155 visualizaciones (últimos 30 días)
Julozert
Julozert el 27 de Mayo de 2020
Comentada: Stephen23 el 8 de Oct. de 2021
Hi,
I have a martix with multiple colums and i want to change the data in one column to the data type "char". How can i do that?
  1 comentario
Rik
Rik el 27 de Mayo de 2020
You can't change the data type of part of a variable. You might get close to what you mean with a cell array.

Iniciar sesión para comentar.

Respuestas (1)

Cris LaPierre
Cris LaPierre el 28 de Mayo de 2020
I suggest turning your matrix into a table. Each table variable can be a different data type. To change, you could simply do the following:
tbl.Var2 = char(tbl.Var2)

Categorías

Más información sobre Tables en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by