LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

binary file conversion

I am using the cont acq to file (binary).vi to collect 8 channels of data with a NI-4472. I need to convert the data to ascii. I have tried to use the array to spreadsheet function, but there is so much data that labview locks up. I am using LabVIEW 7.1. Is there any other way to do this?
0 Kudos
Message 1 of 34
(10,118 Views)
The array to spreadsheet function will work if you process your data in pieces rather than all at once. Do a search on "+large +data +labview" on the main ni.com page and your first hit will be a tutorial that will point you in the right direction. Or try this link. It should work until NI rearranges the website.

Good luck. Let us know if you still have problems.
0 Kudos
Message 2 of 34
(10,110 Views)
I read the tutorial and looked at the example vi's, but I am still confused. I have a binary file of about 900,000 scans on 8 channels. I want to convert the data to doubles and re-store them to a text file. Which vi is the one to use for my application? Any help would be greatly appreciated.

Dave
0 Kudos
Message 3 of 34
(10,113 Views)
Write to Spreadsheet File is the correct VI to use for most applications where you want to write your data to a tab-delimited spreadsheet file. With 900,000 points to write, however, you want to make sure you're using that VI in the correct fashion. How many calls to the Write to Spreadsheet File.vi are you making? This is a high-level file I/O VI that will open and close a file every time it is called. If you are writing data in a loop, you do not want open/close commands to be called every time as that will add a lot of overhead and time to your program. You want to use the Write to Spreadsheet File.vi only if you are writing data once. Then you only have one set of open/close commands, which should be ok.

The other alternative is to use some lower-level file I/O VIs that will explicitly open/create a new file, write the data, and then close the file. I have attached a file called Read Binary File_Convert ASCII.vi to this post. To use this program, run the Write Binary File.vi from the example programs (LabVIEW >> Help >> Find Examples >> Fundamentals >> File Input and Output >> Write Binary File.vi. Then run the attached VI and you will see the binary data file converted to an ASCII output file.

Lemme know if you have any more questions. 🙂
0 Kudos
Message 4 of 34
(10,117 Views)
The "array to spreadsheet string" function takes some time to proceed data.
From timings on several machines, consider that the conversion to floats numbers takes about 4 microseconds/sample, at 1 GHz processor clock speed.
Means that on a 2 GHz machine, assuming that there is no overhead (other application running, file read/write, data display, etc...), processing your data (about 7 millions samples) should take about 15 s.
The conversion to decimal is 2-3 times more rapid.

Never try to visualize the resulting string when the length exceeds 1 Mbytes, since LabVIEW seems to have some problems in handling the display of very large strings. That might be the cause of the lockup that you experienced.
Chilly Charly    (aka CC)
Message 5 of 34
(9,759 Views)
I am using the enclosed vi to do the data collection. My problem is reading the file and converting the data.

I am able to get ascii data using your example, but I'm getting a 1d array out of the read file function. My data is a 2d array. How can I get a 2d array out of the read file function?
Dave
0 Kudos
Message 6 of 34
(10,068 Views)
If you're trying to read 2D data out of a binary file, you will need to enter the datatype into the header input of the Read File.vi. There is a good KB discussing how to write/read 2D arrays to binary files:

KB 2N1DMKM5: How Can I Write and Read Binary Files Using LabVIEW?

This should help you out. Good luck!
0 Kudos
Message 7 of 34
(10,051 Views)
This link gives me an error.
0 Kudos
Message 8 of 34
(10,031 Views)
Bah, ok. Try this.
0 Kudos
Message 9 of 34
(10,027 Views)
Hi,

This is in response to a message you posted a handful of months ago. I am trying to do virtually the same thing as the other user was (i think). I'm using the Cont Acq.&Graph Voltage-To File (Binary).vi to write a 2D array of data from multiple DAQ channels to a Binary file. I then use Read Binary File.vi, with a local variable referenced to Measurement (from first vi) connected to the byte stream type of the Read File.vi (contained in Read Binary File.vi). I tried running this, but I get Error 116:

Possible reason(s):

LabVIEW: Unflatten or byte stream read operation failed due to corrupt, unexpected, or truncated data.

I tried adjusting the read Count, but no solution came of it. Could you give me some suggestions?
0 Kudos
Message 10 of 34
(9,897 Views)