importdata from dat file not picking the first cell
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Import data doesn't read the date from the first cell which is within a string. here is the code.
x = importdata('test.dat',',');
Here is the sample data
"2017-05-19 10:55:08",2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28 "2017-05-19 10:55:08",2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28 "2017-05-19 10:55:08",2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28
disp(x.data) gives the following
2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28 2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28 2,1,1,3.107,15.414,153.65,3.107,3.1,6.96,295.88,0.58,1.1,0.12,107.86,10.78,6.43,12.28
How to pick the first cell which contains the date value
0 comentarios
Respuesta aceptada
dpb
el 24 de Mayo de 2017
The Tips section in the doc for importdata has the following...
Tips
To import ASCII files with nonnumeric characters outside of column or row headers, including
columns of character data or formatted dates or times, use textscan instead of importdata.
You can use the (relatively) new '%D' date format for the dates to convert directly to datetime class.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Import and Analysis 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!