LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

saving 1d array of 2 clusters

I have the attached vi working as I need.  The final piece I need is to save data to a measurement file.  The only thing not happening with it now is getting a timestamp in the file for each element of the array.  Any help would be appreciated.  Thanks.

0 Kudos
Message 1 of 6
(3,170 Views)

could you post a png of the vi as i cant view it as its saved in a later version.

 

but in programming -> timing. there is get time in seconds and then you could convert to julian (normal) format and add it to a cluster

 

hope it helps, will try to give a more informed answer once ive seen the vi

 

 

TD 

Please remember to accept any solutions and give kudos, Thanks


LV 8.6.1, LV2010,LV2011SP1, FPGA, Win7
0 Kudos
Message 2 of 6
(3,155 Views)

The easy answer is that you can add another element to the top of your build array on the right of the while loop and wire the DBL representation of your timestamps to it.  This will give you a timestamp in seconds from midnight, January 1, 1904.  If you want a relative timestamp, you can subtract the start time of the experiment from it.

 

However, there are a few issues with your VI.

 

  1. Why are you converting your timestamps to DBLs, then back to timestamps?  This is unnecessary and truncates a lot of the timestamp resolution (timestamps have 128 bits of resolution, DBLs have 54).
  2. You have a hardware device which can give you timing information far more accurately than fetching the current time from the data collection computer.  Use the Waveform output of your fetch VIs and use the timestamp from that instead of fetching from the computer.  Always use the timestamps from the device, if you can.  Unless you are using LabVIEW RT, timestamps fetched from the operating system are subject to normal jitter on the order of 10-20ms and it could be seconds.
  3. You are specifying multple data points in your configuration, but only fetching 1.  Under the hood, this is fetching the ten or so points and then giving them to you one at a time.  Your program would be far more efficient if you fetched the same number of points you specify in your setup and batch process them.
  4. The case statement around the get current time primitive is unnecessary since it has the same code in both cases.  As mentioned above, the whole fetch is unnecessary.  Get this data from your acquisition VI.

Good luck.  Let us know if you have more issues.

0 Kudos
Message 3 of 6
(3,147 Views)

All you have is an array of values. There are no timestamps. You are building an array of timestamps for the graph, but you are not using them for the data you are collecting, so I don't know what you are asking.

 

Your VI is confusing, and it does not match what you say in the comment at the bottom. The comment states: "This vi is designed to monitor a Digital Input in a while loop and run continuosly until a 1 occurs once.  The array sum is used to detect a 1. " The VI doesn't do that. It keeps looping until you press the button on the front panel or an error occurs. There is also no "array summation" anywhere.

 

Parts of your VI can be simplified:

  • The gymnastics you are doing with the timestamps is unnecessary. You are converting an array of timestamps to a DBL, so you can add another timestamp which you convert to a DBL, and then converting that array of DBL to an array of timestamps. Why? Just use a single Build Array.
  • You are adding the read value to an array and then indexing out the current iteration index to display on the front panel. This is the same exact value as what came out of the DAQmx Read.
  • The little for-loop can be replaced with the Initialize Array function.
0 Kudos
Message 4 of 6
(3,146 Views)

Thanks for the help.  I took your advice I think and fixed issues 1, 2, and 4.  Could you help me out with #3.  I wasn't quite sure what you meant.  Thanks.

0 Kudos
Message 5 of 6
(3,130 Views)

When you configure your acquisition, you tell the hardware to collect ten points.  When you fetch the data, you fetch one point.  This is OK if this is what you want to do, but I suspect it is not.  Unless you are doing continuous acquisition, your buffer size is usually the same as your fetch size.

0 Kudos
Message 6 of 6
(3,113 Views)