LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to store binary files into ascii files

I need to record Data with sampling rate of 100kHz and for that reason I saved this data as a .bin. In principle this file should consist of two rows, the time and the data (voltage) domain with an ?resolution? of 16 bit. For my analysis I need this files as an ASCII file. I´m an absolute rookie in Programming (and LabView as well) and so far unable to slove this problem...can anyone help me?
0 Kudos
Message 1 of 12
(4,241 Views)
Hi Tituriel,

two points:
1) You can do your analysis using LabView without the need to convert the datafiles into ASCII (human readable) format!
2) When the data really is saved as 16 bit values (probably I16 for voltage and U16 for time, both are not very common for this type of operation) you can load them by using the file functions. Depending on your LabView version those functions can have different names. After loading you can use functions like "format into string" or "array to spreadsheet string" to convert the binary data to text. You can save this text very easily using the file functions...

When starting with LabView you should read the manual, look into the examples and check the NI website for their educational courses!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 12
(4,233 Views)
Hi!
   GerdW is right.  Anyway,I'd like to see the chunk of code where you do the actual save to file, and I'd like to know exactly what format the data acquired is stored. If you have a 16 bit DAQ board, for example, you can have data acquired by DAQmx Read function as DBL (double precision).

   Hope this can help..... have a nice day!

graziano
0 Kudos
Message 3 of 12
(4,230 Views)

Hey Guys,

thanks for the fast reply!

To GerdW: 1) I´d like to do the Analysis in another Programm, because I´d already implemented a fitalgorithm in an other programm.

2) I acquire the data with an Analog Input and ist resolution is 16 bit.

Because of the big amount of data, i have to store it as a .bin file otherwise the programm crashes.....

Tomorrow I will try these “Spredsheed to Array Funktion”....

 

To Graziano: I´m not really able to answer your question, but I´ve uploaded the VI! Hopefully this could answer your question.

 

Thanks for your Help and ikind regards

 

Tituriel

0 Kudos
Message 4 of 12
(4,204 Views)
With the front panel settings you have, you acquire 1000 samples at a rate of 10000 samples/sec, write that data, and then stop. What are you actually setting these to? With only a 1000 samples, I don't see why you would have to use a binary file save. Also, since you are using simpler version of the shipping example 'Cont Acq&Graph Voltage to File(Binary), what happens when you use the companion program called Graph Acquired Binary Data?
0 Kudos
Message 5 of 12
(4,198 Views)
when will I have 8.2 LV working? Smiley Mad Still I have 7.1, can'tn open VI, sorry! Smiley Sad

   ...but I guess Dennis can help you Smiley Happy

graziano
0 Kudos
Message 6 of 12
(4,180 Views)
Hello,
to align my setup, I´m working with a lower resolution and depending on the taks also very few Samples. But for my actuall experiment I will need a sampling rate of 1E+6 for a least 3 seconds (3E+6 Samples).
I´ll look up the example you suggested
thanks Tituriel 
0 Kudos
Message 7 of 12
(4,173 Views)
hI!
   3 MSamples is a large amount on a Pentium 1 processor system, with 4 MByte RAM, of course Smiley Happy

    I think that modern PCs can handle quite easily the data you need to acquire. 

   BTW, what DAQ hardware are you using?

   Have a nice day!

graziano
0 Kudos
Message 8 of 12
(4,166 Views)

Hola,

I´m still waiting for the computer I have ordered for my setup, but anyway I have borrowed one...2 GB Ram and a 3.00 GHz Pentium 4, not the worst I guess.

 

 To acquire the data I´m using the PCIe 6251M Series DaqCard and a BNC 2120 Connector Block.

 

Corresponding the example “Graph Acquired Binary Data”. Yes it is possible to display the saved data from the .bin file, but this does not help me to convert it into an txt (ascii) file.

 

So far I´m unable to use the “array to spreadsheet string” function in a proper, working way...I think I have to lern more about the way it has to be programmed....

Tituriel

0 Kudos
Message 9 of 12
(4,148 Views)

You don't mention exactly what is not proper and working about the array to spreadsheet string. Provide some details, please.

Since the Graph Acquired Binary Data is working and displaying correctly, we know that the file contents are correct. You could simply wire up an Export Waveforms to Spreadsheet File to the same place as the graph indicator. See if that file is in the format you want. If it is, then the Export Waveforms to Spreadsheet File can be used in your main program with a few modifications.

Also, what program are you going to use to process the data? There may be an option to load a binary file directly.

Message Edited by Dennis Knutson on 10-18-2007 08:29 AM

0 Kudos
Message 10 of 12
(4,141 Views)