LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

need help writing to spreadsheet file in labview

I'm having trouble actually getting my data to write to a spreadsheet file. I have the data coming in from an LCR meter - continuous conductivity measurements, and am trying to write it to a spreadsheet file to manipulate the data. The data comes from a scan from string vi - i attached it to a make a 1D array function and then the write to spreadsheet file.vi. I get a solid orange line but the only thing that writes to the file is a "0" in one box in the spreadsheet file. I attached the code. Thanks for your help.
 
Bethany 🙂
0 Kudos
Message 1 of 5
(2,989 Views)
As you have not enabled auto-indexing in the while loop, only the last value will be stored in the file. So assuming that the other part of the program works fine, probably using autoindexing and wiring the output straight to the write to spreadsheet file VI will do the job.
BR
0 Kudos
Message 2 of 5
(2,980 Views)
  1. right-click on the output tunnel and select "enable indexing"
  2. remove the "built array" leading to the "write to spreadhseet file" node.

Shouldn't there be a small wait inside the loop?

How long does this loop typically run? Make sure the array does not grow wihtout bounds over time. If this needs to run for extended times, you might want to append to the spredsheet at regular intervals.

0 Kudos
Message 3 of 5
(2,978 Views)
Thanks for your help! I didn't realize that...
 
Why should there be a small wait in the loop? What is that for??
 
Probably the longest runs will be thirty minutes. Why is it a problem if it runs for long periods of time?? How would I get it to append to the spreadsheet regularly?
 
Thanks,
Bethany
 
0 Kudos
Message 4 of 5
(2,972 Views)
Well, without a wait (e.g. a few ms), the loop runs as fast as possible and the speed will be different on different computers. At the same time, the program will consume all CPU time. With a small wait statement, the program will run at the same rate on any computer and the cpu useage will be only a few % (all other programs will thank you ;))
 
The autoindexing shift register must accumulate the array data. If this programs runs for 30 minutes at full speed, this could be gigagbytes worth of data. Growing large arrays incrementally in a a program is very expensive, because memory needs to be reallocated whenever the size grows beyond the initial estimate for the final size.
 
You could e.g. initialize an array with a thousand points (for example) and keep it in a shift register, then add each real data point using "replace array subset" at each loop iteration. Every thousand iteration, you write the array to file (using append) and start over at the first element in the next iteration.
0 Kudos
Message 5 of 5
(2,958 Views)