LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write delimited spreadsheet/Write to text file

I currently have my VI set to prompt the user to have a file path (txt file) before the VI actively runs and prints the data it collects from the VISA resource port but I want the "Write to text file" to be after all the data has been collected (right before it is plotted on the graph) as it is manipulated by the formula node/case structure I have set up. Ideally, I would like all the data to collect into a file that will prompt the user to save the file after the data has populated/VI has finished running into a brand new blank text file. 

 

Would the solution be to Build an Array after my case structure and then have that array connect to a write to text file? I don't know if it would be within the bigger case structure or within the loop or outside. 

 

Any and all help is appreciated! Thank you.

0 Kudos
Message 1 of 3
(124 Views)

Basjong53_0-1713283482207.png

Wire the total data you want to save outside the while loop and wire it to a write delimited spreadsheet.

You will get some replies here that tell you to remove the express VI (and I agree), but this would be the simplest 'fix'.

 

0 Kudos
Message 2 of 3
(114 Views)

You still have not listened to any of our advices, so your code is still full of Rube Goldberg constructs. Why do you need 8 different formula nodes if the only difference is one constant? Why do you build an ever-growing string, rewriting the entire text file from scratch with each iteration? Why do you still do the "scalar-to-array-to-dynamic data" dance if you could just wire the scalar directly to the express vi?

 

A delimited file is just a text file where the column delimiter is a tab (by default) and the row delimiter is a linefeed.

 

All you need to do is open two files before the loop and append data inside the loop. For the text file containing the raw visa string, append the new string to the file. For the delimited file containing your xy data, append a row with you x and y value and the correct delimiters.

 

Here's a simple skeleton (Yes, more code is needed of course!):

 

altenbach_1-1713287364976.png

 

 

0 Kudos
Message 3 of 3
(86 Views)