LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to save two data from two subdiagram into one file?

Solved!
Go to solution

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!

 

0 Kudos
Message 1 of 14
(3,310 Views)

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.

0 Kudos
Message 2 of 14
(3,299 Views)

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.

=====================
LabVIEW 2012


0 Kudos
Message 3 of 14
(3,297 Views)

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?

 

 

 

0 Kudos
Message 4 of 14
(3,289 Views)
Solution
Accepted by ANL

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.

Message 5 of 14
(3,286 Views)

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

0 Kudos
Message 6 of 14
(3,280 Views)

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! 

0 Kudos
Message 7 of 14
(3,263 Views)

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.

0 Kudos
Message 8 of 14
(3,258 Views)

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!

 

0 Kudos
Message 9 of 14
(3,237 Views)

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.

0 Kudos
Message 10 of 14
(3,220 Views)