Split table entry into separate columns

21 visualizaciones (últimos 30 días)
Syed Tariq
Syed Tariq el 6 de En. de 2022
Respondida: Simon Chan el 6 de En. de 2022
I have a table the first column has a string of the format 'ABBV 09/17/2021 120.00 C'. I want to expand the table to 4 additional columns 'ABBV','09/17/2021','120.00','C'

Respuestas (1)

Simon Chan
Simon Chan el 6 de En. de 2022
How about the following:
Name = "ABBV 09/17/2021 120.00 C";
Data = "Dummy";
A = table(Name,Data);
A.Name = strsplit(A.Name,' ');
T2 = splitvars(A,'Name','NewVariableNames',{'newName1','newName2','newName3','newName4'})

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by