cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

SOLVED
HFZ
Member
Member
Solved!

Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Message contains an attachment

Hi to all Programmers.

 

I got attached Datafile. Can some one tell me how to plot this right ! I need all data plotted right  and the x-axe with its date and timestamp.

I understand that the graph cant understand that after the time:  12:59:59.999, it is 01:00:00.000 afternoon .

 

Using Labview 7.1

Regards

HFZ

HFZ
17 REPLIES 17
Knight of NI

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

How are you reading the file and how are you plotting it?
HFZ
Member
Member

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Message contains an attachment

I think its easyer to see the .VI

The Data file has an ID Top Sequence so the :VI can read the file and plot it. :

 

# t[s]                 flow  [ul/min] 
14-05-2009 10:20:56,076     54,714
14-05-2009 10:21:05,717     54,857
14-05-2009 10:21:05,997     54,857
14-05-2009 10:21:06,325     54,714

 

Copy and paste it to the top of the data file to be able to read it by the program.VI

 

I've tried to Convert the date and the time stamps for each data point to a Large Number (time since ...1940...) And then feeds it to a XY- graph. But still the same result.

Try to read the Data file by the program and you can see whats wrong.

 

Regards

HFZ

 

 

HFZ
Knight of NI
Solution

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Message contains an image Message contains an attachment

Aside from some code which can be simplified by the use of other functions, what I see is that the file you provided does not match the format the VI is expecting.

 

Other comments:

  • I don't understand why you're going to all the trouble of changing the time string when all you need to do is this:

  • All the way at the beginning use the Strip Path function to get the name of the file rather than the gymnastics that you're currently doing.
  • Your while loop should be an auto-indexed for-loop.
  • I can't quite figure out what you're trying to do with all those cursors.
Message Edited by smercurio_fc on 05-14-2009 12:19 PM
HFZ
Member
Member

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Thank you for these advice i apreciate that a lot..

The Coursers features is to start with the Point cursors in the middel on the graph... or so..

 

I'm glad that you can tell me that this can be done easyer . But it really dont help me with my problem.

I can see that in your output cluster you have a character more (The -ABC-) For the AM and PM string notes. But they can not be used to pas over to the time converter.

The graph can not see differens between AM and PM and that it is the same date.

 

About the data format from the file I don't understand what u mean exactly ! Can you meaby give me the point where.. i'll be thanksfull.?

 

 

HFZ
Highlighted
GerdW
Knight of NI

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Message contains a hyperlink

Hi HFZ,

 

what a about a simple construct like:IF string="PM" THEN hours:=hours+12 ? That's the usual way to convert to a 24hour format...

 

I would prefer to use a 24h scheme when generating the data (as you already noted it's hazzle-free Smiley Wink) but that may be my European kind of view on using SI units and "standard" date/time strings :smileyvery-happy:

 

In addition to the comments given before:

- I would really appreciate when you could attach vis that aren't "run when opened". You never know what happens in the vi before opening it (and I seldomly load them as subvis...).

- I also would suggest not to hide block diagram objects in small structures (sequence in the middle, small cluster in the lower right,...). Use subvis when the diagram gets to big!

Message Edited by GerdW on 05-14-2009 09:11 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
HFZ
Member
Member

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

HI GerdW and smercurio...

There must be a conversation method or icon that can convert that timeformat :  2-/4/2009 10:21:48,442 AM into a big time number in seconds from 1940,

so the graph can understand a time jump from:  

2/4/2009 12:59:59.785 AM   to  2/4/2009 1:00:00.098 AM     

 

 

 

 

HFZ
HFZ
Member
Member

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

The graph cant understand a time stamp change from :  1/4/2009 11:59:59.918 PM  to  2/4/2009 12:00:00.246 AM     

neither a change from :                                                      2/4/2009 12:59:59.785 AM  to  2/4/2009 1:00:00.098 AM

The graph jumps front and back to place the time stamps for the data .

 

I tried to set some timeformat up in the Graph proberties, but it seems to be ignored some how !

 

HFZ

HFZ
Knight of NI

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Message contains an attachment

HFZ wrote:

HI GerdW and smercurio...

There must be a conversation method or icon that can convert that timeformat :  2-/4/2009 10:21:48,442 AM into a big time number in seconds from 1940,

so the graph can understand a time jump from: 


There is "conversation" method or icon. You have to parse the date yourself given your format. Search around on this forum and you will find this comes up a lot.

 

As for the graph, it can understand time jumps just fine:

 

HFZ
Member
Member

Re: Wrong plot when plotting data with timestamp from AM - PM or clockwise !!

Hi Smercio....

Thanks for the advice... it was the format string that has a wrong code when reading an American date format because it is with the ´DOT  ".", and my PC- System is set to the europaen format  Comma " , " !

Thanks for all that help Folks!  Apreciated!

But now when this is done,  I cant get the format changed due to the plotting Data on the Data Window in the Cursor legend palette window.

 

HFZ

 

HFZ