The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Plotting the past day of data starting at 11:59pm each day.
Replies: 1   Last Post: Apr 4, 2013 4:37 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 9,850
Registered: 6/7/07
Re: Plotting the past day of data starting at 11:59pm each day.
Posted: Apr 4, 2013 4:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 4/4/2013 11:12 AM, Lcy wrote:
> I am reading in data as it comes in from a machine 24/7. I would like to
> plot each day's data for the past twenty four hours from 12:00:00AM to
> 11:59:59pm. The data comes in as a text file with the date & time
> including seconds available to use for datenum. I was thinking of using
> " if rem(dates,0.9999999990686880)==0 " kind of set up to recognize a
> specific time and go from there, but it reads in every few seconds, and
> this solution would be hit or miss. I am seeing if there is an easier
> method to tell matlab that at 11:59:59 PM everyday to plot the past
> twenty four hours of data and save it.

How are you scheduling the program and holding the daily data? If
you're running a sequential loop where everything completes in sequence
I've some fairly clean ways to suggest doing it based on a series of old
coal ash and sulfur analyzers I supported years ago (and a very common
round-robin scheduling mechanism it was, nothing unique). But, before
going further let's be sure we're on the same page...if it's
interrupt-driven or somesuch will need different technique.

> I would like to know also how to include the date of which it is reading
> in the plot name. For instance, if the matlab program were reading in
> today's data(04/04/2013), the plot name would be saved as
> aerosoldata04042013.png or something like that.

That's simple enough if now how you're getting the date that you want to
write...see comments below and when we get a sure answer then we'll
attack it, too...

> Here is a copy of what I have so far that plots the past 24 hours of
> data from the last reading of data.
> %% clear all; clc ; echo off;
> %opens and reads file
> fid =
> fopen('\\DEL..._Data.txt','rt') ;
> %sets up delimeters
> fmt = '%s%s%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f';

% A cute shortcut in building format strings...
% btw, I got the 19 by sum(fmt=='f')
fmt=['%s%s' repmat('%f'1,19)];

> data = textscan(fid, fmt, 'Delimiter','\t', ...
> 'headerlines', 1,'commentstyle','ZBXX');
> fclose(fid);
> %% gives data set names
> mode = data{1}; %
> datein = data{2}; %


> for i = 1:length(datein)
> dates(i) = datenum(datein(i), fmt);
> end

OK, I'm now officially read the file using fmt into a
cell data array and datein is the second cell contents of some date
string apparently but fmt should now be somethin datenum() can grok...

So, what is the actual format for the date string as read???


> Any help would be greatly appreciated!

Clarify the points above and we'll go from there...


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.