Reputation: 1138
I have high resolution data (500 Hz). I started at 12:00:00 p.m.
In total I have 7.2 million data points <7,200,000x1 double> called data. How would I plot it against real time, like 12 pm, 1 pm, 2 pm, 3 pm, 4 pm, etc. (date ticks)
Upvotes: 1
Views: 4836
Reputation: 124553
Consider this example:
Fs = 500; %# sampling frequency (Hz)
startTime = datenum('12:00:00 PM','HH:MM:SS PM'); %# recording start time
x = cumsum(rand(7200000,1)-0.5); %# some random data
t = (0:(numel(x)-1)) ./ Fs; %# time in seconds
t = t/3600/24 + startTime; %# time in days (serial date)
%# plot
plot(t(1:2000:end), x(1:2000:end)) %# plot every 2000 values
datetick('x','HH:MM:SS PM')
xlabel('Time'), ylabel('Data')
The formatting of the date axis tick marks is done using the DATETICK function. Read the documentation to learn how to customize the date format.
Note that as you have millions of points, I opted to plot a sub-sample (every 2000 values), but you can easily change that to plot the entire data if you like...
Upvotes: 6