ni.com is currently experiencing unexpected issues.
Some services may be unavailable at this time.
04-20-2012 10:02 AM
Hi guys,
I would like some help with saving data in labview 2010 SP1 (base development system). I am using a "Write to measurement fil express VI" inside a while loop and the data out from the DAQmn Read is wired to the signal in of the "Write to measurement fil express VI".
The way I have wired it is the VI saves the data as a text file after it has recorded 100 samples (the nuber of samples to read in this case was set to 100). I would like to know if there is a way to control the rate at which the express VI saves the data. As in, I want the express VI to save the data at specified time interval or at every nth iteration. I have attached the main VI and its 2 sub-VIs for reference. Please let know if anyone can help me resolve this issue. Thank you for your time and inputs in this regard.
Raj
Solved! Go to Solution.
04-20-2012 10:15 AM
Adding to the previous post, I do know of one solution for this issue which is using the Producer-Consumer architecture. However, I am fairly new to labview and do not know exactly how to make use of such an architecture. I'd avoid it if there is another way of solving this issue of saving data to text file at every nth case of the while loop. Thanks for your help.
Raj
04-20-2012 11:31 AM
Saving 1000 words
04-20-2012 11:45 AM
Thanks for the prompt reply Jeff. It works. I'd like to however have the option of recording the data only when I click on the record button rather than having the VI automatically save the data as soon as the code id executed. Can you please suggest how I can achieve this?
04-20-2012 11:58 AM
OR "Record" and the "=0" outputs.
just that simple.
05-15-2012 02:47 PM
Hello jeff, Im trying to use your advice. What are you comparing on the quotiant and remainder. Iterations "n" and ? (The 32 bit integer)
Also the green new_file drop down in the write to measurement file what is that for?
I do not see that I am using Labview 2011.
Thanks
05-16-2012 01:36 PM
Robert,
First, you must understand that the above code resides inside a loop. The blue square i terminal is known as the iteration terminal. It provides the current loop iteration count, starting from zero.
The first input (x) to the Quotient & Remainder Function comes from this iteration count (i) terminal of the loop.
The second input (y) to the Quotient & Remainder Function comes from the control N.
We wish to write to the measurement file every N iterations of the loop. If we take our current iteration count (i) and divide by our desired N, every Nth iteration of the loop, the remainder will be zero. For all other iterations, the remainder will be non-zero.
That being said, we check the remainder and compare it to zero. If it is zero, we will send a True value to the Enable terminal on the Write To Measurement File Express VI. Any time a True value is sent, we will write to file. Anytime a False value is sent, nothing will be written to the file.
The green new_file input on the Write To Measurement File Express VI is used when the "Save to series of files (multiple files)" radio button is selected in the Configure dialog box of this Express VI. When "Save to one file" is selected, this option does not apply, and so it is not included in the input list, which is why you are not seeing this.
This new_file input is used to tell the Write To Measurement File Express VI when to start writing to a new file.
06-30-2015 01:59 PM
I believe this code writes only the data in the current loop to the file... in other words, if you're writing every 10 loops...
Loop 1: don't write data
Loop 2: don't write data
...
Loop 10: write data acquired in loop 10 (but not data from loops 1:9).
Is that correct? If so, how would I go about modifying this code so that it writes all the data that's been gathered since the last write? In other words...
Loop 1: don't write data
Loop 2: don't write data
...
Loop 10: write data 1:10
Loop 11: don't write data
....
Loop 20: write data 11:20
...
07-01-2015 06:43 AM
@solobo wrote:
I believe this code writes only the data in the current loop to the file... in other words, if you're writing every 10 loops...
Loop 1: don't write data
Loop 2: don't write data
...
Loop 10: write data acquired in loop 10 (but not data from loops 1:9).
Is that correct? If so, how would I go about modifying this code so that it writes all the data that's been gathered since the last write? In other words...
Loop 1: don't write data
Loop 2: don't write data
...
Loop 10: write data 1:10
Loop 11: don't write data
....
Loop 20: write data 11:20
...
Conversation moved to here: http://forums.ni.com/t5/LabVIEW/Write-data-to-file-every-10-or-N-loops/m-p/3159034/highlight/false#M...