04-25-2011 04:50 PM
Hi folks!
I am having some problems saving data from the loop in the attached vi.
I am using the vi to adress some multiplexeres and measure the voltage difference from that particular address.
However the vi only saves the data from the last iteration. I have confirmed this because I tried going from 1-16 in the loop iteration
one at a time and the values always change, but running for the 16 iterations I always get the same values.
Can anyone see what I am doing wrong in the code. Also any advice on the rest of the code is always welcome since I
am sorta new to LabVIEW.
Thank you very much for your help.
Cheers!
04-25-2011 05:31 PM
The loop is only set for 1 iteration. Did you notice that? Did you expect to see 16 set of data point in 1 file for 16 iteration? I am just making sure what you are looking for.
04-25-2011
05:38 PM
- last edited on
05-09-2025
07:55 PM
by
Content Cleaner
Also, I'm guessing you meant for that to be a 2D array that you indexed one row at a time into your loop, instead of a 15D array:
For more information on indexing data into and out of loops, check out this help document.
04-26-2011 03:49 AM
Hi guys.
@ jyang72211 : It was saved for 1 iteration because I was still trying some coding. I use all 16 iterations and I get a set of data. The problem is that it only saves the data for the last iteration (the 16th one) and it saves that data to all the 16 sets of data. And I know that because if I run one iteration at a time I get different sets of data than the data I get from running the 16 iterations at once. Hope that was clear.
@Darren : I'm using that array to address the multiplexers. Although I didn't quite understand the difference between the two representations...If you could explain further
I would appreciate it.
Cheers!
04-26-2011 06:28 AM
Also, after some tries I found out that using a delay of 10 seconds inside the loop I get all the right measurements.
But If I use 1 second I get the worng values again!!
Any thoughts???
Cheers!
04-26-2011 08:50 AM
@Darren : I'm using that array to address the multiplexers. Although I didn't quite understand the difference between the two representations...If you could explain furtherI would appreciate it.
A 1D array is a single row/column. A 2D array is rows and columns, like a spreadsheet page. A 3D array is where the third dimension refers to another page of rows and columns. Like an additional sheet in an Excel workbook. A 15D array ... well, that's getting into superstring theory, and I know this is going to sound disappointing to you, but frankly, your VI is not pushing quarks around or trying to shatter the space-time continuum (thank you for that, by the way). So, stick with the array being a 2D array.
04-26-2011 09:14 AM - edited 04-26-2011 09:15 AM
Regarding the 1 sec and 10 sec delay.
I don't know what amount of data must be written in the file but it could happen that the Write To File Vi uses some external functions (e.g. "dll") which use some kind of global variables.
If you start another write before ending the previous one (one write to file could take more than data acquisition from NI Bord) the previous one is cancelled.
I'm not sure, it just a taught.
04-26-2011 09:35 AM
The Write To File Express VI is configured to save to different files each time.
This means it will save the data from the first iteration in the file with the name you specify, then each subsequent iteration's data will get a separate file with a serialised and/or timestamped name.
Could this be your problem?
MC
04-26-2011 10:39 AM
The main problem I am facing is that the For Loop only records the last data from the 16th iteration and
not the data from all the iterations.
04-26-2011 10:48 AM
Drive the Waveform signal out from the loop (using indexing) and write to file after the entire acquisition was done.
I don't see why you have to do it after each iteration and not once at the end.