05-10-2011 02:41 PM
Hi,
I have a VI measuring the voltages from different channels one after another. How could I save the two average data into one file in two column? The vi is attached. Thanks!
Solved! Go to Solution.
05-10-2011 03:37 PM
How are you running your VI?
Right now it is set up to run just a single time. It reads data from the first instrument. Once that is all done, it will read data from the second instrument. Then the VI ends. You can take your two pieces of data and convert them to strings, and concatenate them together with a tab in between, then write that string to a file.
05-10-2011 03:43 PM
The easiest way is to use the write to spreadsheet file vi. Use build array with your two values.
Why do you have the same identical code in two frames of a sequence structure? Are both devices the same visa resource? Just use two read data vis in series.
05-10-2011 04:45 PM
Ranvens and Steve,
I am a totally new person with Labview, The two read out data are from the same multimeter but different channels, the values are different. I do not know how to use two read data vis in series, does it only read from the same source same channel?
I just simplely use the examples provided by the instrument company and get the measurement. I am using a while loop to get the data continously, the program useful for me is in CASE STRUCTURE LABEL 1. now, the new question comes out: I will need to save the present wavelength, average data 1 and average data 2 into three column, and save the data in new file to cover the old file as the scan goes on.
How could I do that?
05-10-2011 04:51 PM
Look at the context help and then detailed help for the Write to Spreadsheet file function to know what each connector is for. You have multiple things hooked up and some things incorrectly.
The bottom input is a boolean for Appending data. You want that to be a True constant since you want to constantly write new data to the file on each iteration of the loop.
You can't have 1-D and 2-D connectors at the same time hooked up. It is there to give you options. If 1-D connector has data it uses that, otherwise it uses the data on the 2-D connector.
What you want to do is take all 3 pieces of data and build it into a 1-D array and wire that into the 1-D connector. Leave the 2-D connector blank.
05-10-2011 05:39 PM
Ravens,
That works great!
An annoying thing is it keeps pump out a window ask for the file save directory, I have to choose the file when there is a new data point. How to make it automatic so it just keep on adding data to the file?
Thanks!
ANL
05-10-2011 06:45 PM
I simply wired the file path with the new file path. The dialog box does not show up anymore, but all the data is stored in the same file even when I start a new series of scan. I want the dialog box shows up when a new scan starts.
Thanks!
05-10-2011 10:48 PM
You can programmatically manipulate the file path. You can use string functions to come up with a new filename each time. And use Build File Path to add the filename to the rest of the file path.
05-11-2011 02:45 PM
Still quite do not understand.
I used a string to convert to path and the link together, if the constant is empty, it continues to store data in the same file, even I start a new scan, it does not ask for the new path. If the constant is a number, it will show the dialoge every single data point again.
Attached is the file. Any thing is wrong?
Many thanks!
05-12-2011 05:57 PM - edited 05-12-2011 05:58 PM
That feedback node seems to be storing the value from the previous iteration. You could avoid this by hooking up an empty path to the initialization terminal. See if that helps your code's execution.