How to split a column with a numeric data into multiple columns by digits in timetable?
Mostrar comentarios más antiguos
Hello, Thank you for helping this out.
I have a timetable (345533X1 timetable) like below with a numeric numbers in Var1:
Time Var1
20220804 00:00:01 1577990
20220804 00:00:02 1576990
... ...
What I want to get is timetable with seperated columns (345533X7 timetable):
Time Var1 Var2 Var3 Var4 Var5 Var6 Var7
20220804 00:00:01 1 5 7 7 9 9 0
20220804 00:00:02 1 5 7 6 9 9 0
... ... ... .... ... ... ... ....
Do you have an idea to solve this out..?
I tried split functions, but it won't go well...
Respuesta aceptada
Más respuestas (1)
Hi!
Below will not work for negative elements ...
Time = datetime(["20220804T000001"; "20220804T000002"],'InputFormat','uuuuMMdd''T''HHmmss') ;
nbr = [12455; 12456] ;
var = str2double(string(num2str(nbr) - '0')) ;
tbl = table2timetable(addvars( array2table(var), Time, 'Before', 'var1'))
Hope this helps
1 comentario
Dohee Kim
el 11 de Ag. de 2022
Categorías
Más información sobre Get Started with MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!