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

1 view (last 30 days)
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:
0.000347222223354038
0.000694444446708076
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?
Thanks

Answers (1)

Eric Sofen
Eric Sofen on 13 Dec 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).

Categories

Find more on Dates and Time in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!