Azzera filtri
Azzera filtri

problem plotting excel date, cant convert to HH:MM:SS only

2 visualizzazioni (ultimi 30 giorni)
I have been fighting with this data for a little while I've managed to do most of what I want with it.
Currently I am having issues with plotting. The data I have is over the course of 2+ days, however my experiment doesnt start until ~20 hours in. The way time is recorded is either like this:
which I can plot. However, with this I count to 24 and then start over, or start at 18:00:00 rather than zero. The experiment time ranges from 12 to 20 hours.
Tthe other 'time' data column that starts at zero when the experiment starts and counts total time, but I can't seem to import it correctly into matlab. 'readmatrix(file.csv)' gives NaN for that column. I can get the column as text if I do '[num, text, both] = xlsread(file.csv)' but I can't seem to convert it to a datenum or anything that matlab will recognize to plot.
this is the type of date that matlab won't read: '1899-12-30 00:00:00'
Any ideas for how I can either read the data, or somehow convert my datetime (ex:0.000347222223354038) into total time starting at time = zero?

Risposte (1)

Eric Sofen
Eric Sofen il 13 Dic 2019
I'm not entirely clear about what your data looks like. Attaching a file would help. That said, I suspect readtable would do the trick. Readmatrix expects all of the data to be the same type. In readtable, timestamps like '1899-12-30 00:00:00' would be read as a MATLAB datetime variable. You might want to subtract off the first element from all of the datetimes to get a vector of durations (time since the start of recording - your distinction between the start of the file and start of the experiment confused me).


Scopri di più su Dates and Time in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by