💸 Reduce costs by consolidating proprietary analytics & reporting software to open-source & Dash.
Challenge us to replace your analytics with Dash and reduce costs.

Matlab, Dates, rounding to nearest hour

I need help on a matlab date issue.

PROBLEM: On https://plot.ly/~CornellDatalogger/338, the datetime is being rounded to the nearest hour or so. (I have 5-minute level data, so about 10 observations are being rounded to one number.)

DESIRED OUTCOME: Provide a work-around, so the Matlab code does not round the time when the data is sent to plotly. (Alternatively, give me some sample code to make this work using date strings)

DETAILS AND CODE TO REPRODUCE ERROR

In this picture, it shows up as jagged/stairstep. About 10 datapoints are rounded to the same number.

​
This is different from the matlab, which plots correctly. (no stairsteps).

(can’t upload, limits me to one image)

​
All of these numbers in Matlab:

1444885800000
1444886700000
1444887600000
1444888500000
1444889400000
1444890300000
1444891200000
1444892100000
1444893000000
1444893900000

are being rounded to (in plotly)

1444890000000

1444890000000
1444890000000
1444890000000
1444890000000
1444890000000
1444890000000
1444890000000

1444890000000

I believe many of your users will have this problem. I followed the reference code from your help pages here: plot.ly/matlab/time-series/

I’ve attached my .mat file (data) and the matlab code to reproduce this is below:

(to get the matlab code, go here: http://www.filedropper.com/plotlytesttimetemperaturemat)

% START MATLAB CODE

load(‘PlotlyTestTimeTemperature.mat’);

plotlydate=uint64(convertDate(datenum(outdoorTimes)));

% verify that integer isn’t being cut off. See the numbers, not rounded.

plotlydate(1:10)

%this plot looks fine
plot(plotlydate, outdoorF);

plotlyfig = fig2plotly(gcf,‘filename’,‘myfig’);
plotlyfig.layout.xaxis1.type = ‘date’;
plotlyfig.PlotOptions.FileOpt = ‘overwrite’;
plotly(plotlyfig);
% the plotly online version has converted the date to a double-precision (I think). Accordingly, multiple Times show up as the same. This is verified by looking at the DATA JSON on then plotly website.)

% END MATLAB CODE