LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write waveform data in txt file

Solved!
Go to solution

HI.

I use visa and serial protocl in my vi nad want to save data come from MCU in labview in txt file format which in data save in each line not each tab.

I just want to save data not time. meanwhile I plot the data in graph.

I search in forum and review the posts but can not find solution.

 

0 Kudos
Message 1 of 19
(6,293 Views)
There are thousands of examples in the boards and you have already been told about some specific functions - http://forums.ni.com/t5/LabVIEW/save-data-in-excel/m-p/2948140/thread-id/850949#reply-form

What have you tried? You've had months since your last post so please explain with some details and show your current program.
Message 2 of 19
(6,279 Views)

Yes you are right.

my expectation from vi : those arrays are my final data and I want to save them into separate txt file (each bnumber in separate line), with float format with 9 precision. data will be saved until I stop program and next time that I run program, new files create in vi directory and save new data. file names are date and time with suffix (number of channel). like : channel1_2014_11_29_17_30.txt   or   

here is my blocks :

f2.png 

p.s. I appreciate for your helps and I don't need available VI (I don't like that it cause to misunderstanding with you 😉 ) it will be good if you give me explanation from VI .

Thank you. 

0 Kudos
Message 3 of 19
(6,246 Views)
Are you sure you want 4 separate files? It's doable but you may need to get a bit fancy with a product consumer architecture so that your file writes won't slow down your acquisition. To save to a single file is trivial. You just take the values, wire to a build array, wire the array to a Write to Spreadsheet File. This still might slow your acquisition. I don't know what the delay is in the loop.

When do you want to create the file name? Every day at midnight?
Message 4 of 19
(6,235 Views)

Thanks for your answer.

delay in while loo is for serial communication and it is 1ms.

I want every time I run program data of 4 channel save in seperate txt file. if save in new file cause my program be slow, I can save data in each file and next overwrite files with new data and don;t need to new file and new name and ...

 

0 Kudos
Message 5 of 19
(6,221 Views)
In order to keep up with that fast of an acquisition, you will have to use the producer/consumer design. Look at the example that comes with LabVIEW and see how far you you can get. You'll be passing data via a queue. I would create a single queue with a 1D array and separate the values in the consumer loop to create the four separate files.
0 Kudos
Message 6 of 19
(6,209 Views)

can u send an exapmle for me ?

a VI which in your method has been used.

Thanks.

0 Kudos
Message 7 of 19
(6,200 Views)
Help> Find Examples. Or, click on 'New...' from the file menu and look at the design patterns.
0 Kudos
Message 8 of 19
(6,191 Views)

I use this methode for save waveform, but when I stop the program and view ftxt file, only one byte saved in it and other data don't save !

here is my prgram block diagram and my chart in front panel, as you can see waveform in front panel can't save in specified txt file.

savwe.png

 

 Chart :

re.PNG

Thank you.

0 Kudos
Message 9 of 19
(6,117 Views)

You have the append to file? input left disconnected. The default is False, meaning that it will overwrite the file everytime it is called. Tush, you get only the last value.

 

You need to set append to file False the first time you call the VI to create the file and then set it True on all subsequent calls to append the data.

 

Similarly, you do not need to use String Size. Just wire return count from VISA Read directly to the case selector terminal. That terminal will accept integer numeric types. Set what is now the False case "..0" to handle all negative values and zero. Change the True case to "1.." to handle all positive values.

 

Lynn

Message 10 of 19
(6,113 Views)