Split table entry into separate columns

20 次查看(过去 30 天)
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'

回答(1 个)

Simon Chan
Simon Chan 2022-1-6
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'})

类别

Help CenterFile Exchange 中查找有关 Data Type Conversion 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by