LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to wrtie data to a file in this vi?

Solved!
Go to solution

I try to use the existing vi to record the resistance data measured. It seems to me that the vi only can display the data but cannot store the data to a file (EXCEL or TXT). I tried to use "write to spreedsheet vi", but  it does not work. Could anyone give me some help? Thanks!! Both vi and picture are attached. I am very new to labview.

 

Thanks in advance

Download All
0 Kudos
Message 1 of 12
(4,026 Views)

While you have a very old version of LabVIEW, I would recomend you check out the free tutorials.

 

You've made a couple of fundamental errors. First, what is exiting the while loop is only the result from the very last iteration. You can right clcik on the exit terminal and select 'Enable Indexing'. This will create a 1D array that you can pass to the Write to Spreadsheet. Second error is that the Write to Spreadsheet in 7.1 is only capable of accepting 1D or 2D DBL arrays. You will have a string array. Either convert the string result to a numeric or change the Write to Spreadsheet to accept string arrays. Directions are on the block diagram. Third, your VI can only be stopped by pressing the Abort button. That is bad design. Use a front panel Boolean wired to the termination terminal. You don't need that invert function. Just right click on the termination terminal and select 'Stop if True'

Message 2 of 12
(4,014 Views)

Thanks to Dennis for providing a precise & detailed description.

Since I did some changes before reading his post, I'll post the image of the code changes below.

 

You can use the Context Help (Help menu > Context Help, or the large Question Mark at the top rightof block diagram) to show you how to connect your data (array) to the Write To Spreadsheet File.vi.

 

 

 

Message Edited by Ray.R on 12-07-2009 01:00 PM
0 Kudos
Message 3 of 12
(4,002 Views)

An observation:

 

I noticed that your block diagram has a red contour which indicates that you have set a breakpoint when the VI is run.  

This will pause the execution everytime you run it.  You should (probably) remove the breakpoint.

0 Kudos
Message 4 of 12
(3,987 Views)
Solution
Accepted by topic author Booo

Thank you so much for your kind help. I can save the data into a spreadsheet now. The only problem is that the data is saved in a row but not in a column.

 

 

0 Kudos
Message 5 of 12
(3,935 Views)

Can you post your code and some sample data?

 

It may need a simple ajustment.  😉

0 Kudos
Message 6 of 12
(3,930 Views)

The code is attached and the data is saved in a row like the attached picture. I do not know how to save it in a column. I also try to make the program to display the average, stand deviation of the data and display each data point in the plot in term of index number. So far I only can figure out how to display the min and max of data.

 

 

Thanks a lot

 

Booo

 

    

Download All
0 Kudos
Message 7 of 12
(3,914 Views)
I think I solved some of the problems. Now the vi can display mean, Std, max and min. Now the problem is still the data are saved in row in spreedsheet. I want the data to be solved in a column. I attched the vi. Thanks a lot for your help.
0 Kudos
Message 8 of 12
(3,893 Views)
Wire a True to the Transpose input.
0 Kudos
Message 9 of 12
(3,890 Views)

Dennis,

 

       Thank you so much for your help!! Now the program seems to work well. I want to save some text information regarding the sample with the resistance data into the same file.  Could you suggest a way to do that? The Vi is attached.

 

 

Best,

 

Booo

0 Kudos
Message 10 of 12
(3,852 Views)