LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Array 1 element a double int and the other Date and time for output to file

Solved!
Go to solution

Trying to modify labview example Agilent 34401 Acquire and Graph - SW Triggered.vi 

 

to output the data into a file with a time/date stamp, outputing things in a comma delimited file is very simple in PHP, C, C++ and I've heard this labview thing was great fast tool but I've been working on this simple mod for 5 hours now and still can't get this to work. 

 

I've attached my modified example but I can't seem to get this thing to convert the time and date to something that can go into the same array as the data..

0 Kudos
Message 1 of 29
(4,688 Views)

You're approaching the data conversion the wrong way. The datatype of the data itself is a double precision float, or "DBL". An array must contain only one type of data, so either all DBLs or all strings. Convert all of your data to strings and include the timestamp strings to get a 2D array of strings that you want in your file.

Like this:

Timestamp.PNG

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 29
(4,674 Views)

The easiest thing to do would be to convert the LV timestamp to a double like this:

 

Timeconvert.png

Then you can add it to your array of doubles your instrument driver produces.

 

I also have a vi that does that for you too.

 

Timwriter.png

========================
=== Engineer Ambiguously ===
========================
Message 3 of 29
(4,652 Views)
RTSLVU's time stamp to DBL conversion is the simplest way to do it, but it's not human readable in the file, so choose whichever you want based on your uses. If all you need to do is read back the data later, then use DBL time stamps. If you need someone to be able to read the time stamps, use strings.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 4 of 29
(4,641 Views)

@James.M wrote:
RTSLVU's time stamp to DBL conversion is the simplest way to do it, but it's not human readable in the file, so choose whichever you want based on your uses. If all you need to do is read back the data later, then use DBL time stamps. If you need someone to be able to read the time stamps, use strings.

Yes, but all you have to do is open the file in Excel, highlight the column and "Format Cells" into the time and date format you want.

 

 

Writting  the string "6/27/2016  8:38:32 AM" instead of instead of  "42548.3600925926"  and then formatting it in Excel can lead to problems when dealing with Excel files.

 

I used to do the date string all the time, until one day the lead engineer of a project I was on took me into his cube and showed me how much extra work it created for him because I took a shortcut.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 29
(4,637 Views)

RTSLVU wrote:

Yes, but all you have to do is open the file in Excel, highlight the column and "Format Cells" into the time and date format you want.

Writting  the string "6/27/2016  8:38:32 AM" instead of instead of  "42548.3600925926"  and then formatting it in Excel can lead to problems when dealing with Excel files.

I used to do the date string all the time, until one day the lead engineer of a project I was on took me into his cube and showed me how much extra work it created for him because I took a shortcut.


 

Actually I take back some of that.

 

It appears that modern versions of Excel do a much better job of converting the format of time and date cells that were written as strings.

 

Back in the day (probably Office 2000)  if you wrote time as a string like ""8:30 PM"" Excel could not reformat that cell.

========================
=== Engineer Ambiguously ===
========================
Message 6 of 29
(4,623 Views)

Thanks for all the options but the intent of this is reading the 34401A value over time so a human readable time stamp is required, I believe that is what you have shown in the photo.

 

Being new to LabView but not to programming, I don't see why they would require "Array Size Function"  which feeds "Initialize Array Function" when in normal languages the Init Array would clear the array. That does not seem intuative at all.

 

However, the current problem is how did you apply the time and date format, it looks like text but of course when I apply the text box as shown I get the terminal type error

 

Thanks for all the help thus far

0 Kudos
Message 7 of 29
(4,608 Views)

@rr1024 wrote:

 

Being new to LabView but not to programming, I don't see why they would require "Array Size Function"  which feeds "Initialize Array Function" when in normal languages the Init Array would clear the array. That does not seem intuative at all.


Initialize array does not mean "clear the array".  You talk about clear array as creating an empty array.  Intiialize array creates an array of a given size, a size YOU give it, all of the same element.

 

As for your wiring problem, you didn't use the same function.  You used "Get Date/Time String" instead of "Format Date/Time String".  Compare the icon on the node you used to the icon shown in the example.

Message 8 of 29
(4,588 Views)

Well finally got it to run but the problem now seems to be outputing a file exceeds the memory of the 34401 which makes no sense at all

 

I have no idea why the program as soon as it's launch forces the user choose a file, bypassing the little icon to the left of the path/file box, does anyone know what causes this.

 

I guess I should explain my intent for this program

1. Start it, have it monitor and graph the output of 34401 on a GPIB

2. If the file is selected then dump the output with time stamp to a csv file in the form of

2016Jun29 8:45:32:001,1.599

2016Jun29 8:45:32:002,1.599

2016Jun29 8:45:32:003,1.599

 

So this is my goal which I seem to have failed at thus far but I thank all of you for your help so far, please bare with me while I attemp to learn this labview thing

Download All
0 Kudos
Message 9 of 29
(4,558 Views)

@rr1024 wrote:

Well finally got it to run but the problem now seems to be outputing a file exceeds the memory of the 34401 which makes no sense at all

 

I have no idea why the program as soon as it's launch forces the user choose a file, bypassing the little icon to the left of the path/file box, does anyone know what causes this.

 

I guess I should explain my intent for this program

1. Start it, have it monitor and graph the output of 34401 on a GPIB

2. If the file is selected then dump the output with time stamp to a csv file in the form of

2016Jun29 8:45:32:001,1.599

2016Jun29 8:45:32:002,1.599

2016Jun29 8:45:32:003,1.599

 

So this is my goal which I seem to have failed at thus far but I thank all of you for your help so far, please bare with me while I attemp to learn this labview thing


Is the Path Control empty? That is do you have a path entered in the control before you start the program? If not I believe you will be presented with a file dailog.

 

 

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 10 of 29
(4,542 Views)