import data from text file
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Alec Bledsoe
el 13 de Sept. de 2022
I have a text file of values generated by an elvis data collection board. I am trying to import the values into matlab but I cannot get it organized properly. I am trying to get just the time in seconds (including decimal values) and the voltage (the last value in each line) but it is not coming in correctly. I have tried the importdata and readmatrix without any luck. I would manually enter the data but there is 152000 lines. I have only been able to read the voltage values so far. I have the file as a .csv and a .txt but they both have the same results.
Time Dev1 (NI ELVIS II+)/ai0
9/13/2022 08:25:02.307736 -4.046230E+0
9/13/2022 08:25:02.307836 -4.046230E+0
9/13/2022 08:25:02.307936 -4.045264E+0
9/13/2022 08:25:02.308036 -4.044619E+0
9/13/2022 08:25:02.308136 -4.044941E+0
9/13/2022 08:25:02.308236 -4.044297E+0
9/13/2022 08:25:02.308336 -4.044941E+0
9/13/2022 08:25:02.308436 -4.045908E+0
9/13/2022 08:25:02.308536 -4.045586E+0
9/13/2022 08:25:02.308636 -4.044619E+0
9/13/2022 08:25:02.308736 -4.045586E+0
9/13/2022 08:25:02.308836 -4.044941E+0
9/13/2022 08:25:02.308936 -4.044941E+0
9/13/2022 08:25:02.309036 -4.045264E+0
0 comentarios
Respuesta aceptada
Walter Roberson
el 13 de Sept. de 2022
If you readtable() then with that data, it should detect 3 columns, with the first one being datetime() and the second being duration() and the third being data.
Create a new variable that is the Time (datetime) plus the duration; you might want to set as Format for the result.
Now if you take the datetimes minus the first datetime in the variable, then you will get duration relative to the beginning of the table. You can then ask for seconds() of that to get the duration in seconds relative to the beginning of the table.
3 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!