LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert Large Binary File to Large ASCI File

Hello, I need some suggestions on how to convert a large binary file > 200MB to an ASCI File. I have a program that streams data to disk in binary format and now I would like to either add to my application or create a new app if necessary. Here is what I want to do:
 
Open the Binary File
Read a portion of the File into an array
Convert the array to ASCI
Save the array to a file
 
Go back and read more binary data
Convert the array to ASCI
Append the array to the ASCI file
 
Keep converting until the end of the binary file.
 
I should say that the binary data is 32-bits and I do need to parse the data; bits 0-11, bits 12-23, and bits 31-28, but I can figure that out later. The problem I see is that the file will be very large, perhaps even greater than 1GB and I don't have a clue how to read a portion of the file and come back and read another portion and then stop at the end of the file. I hope to save the data in a spreadsheet.  If anyone has some experience with a similiar situation I'd appreciate any input or example code.
 
Thanks,
joe
 
 
0 Kudos
Message 1 of 7
(3,552 Views)
One thing thats easy to overlook is that the "read from binary file" VI reads characters from the current file position.  Moving the file position around and accessing the file is broadly reffered to as a "random access file". The way you set the current file positon is through the "Advanced" File IO Palete (in LV 8).  You can store this value in a shift regester, or some other variable so that you can essentially digest smaller components of the file as you wish.  Once you read the characters (just read them as unsigned ints so that they are all 32 bits) you can do some of the bitwise operations with some clever programming to extract the bits you are intrested in.

-hope it helps-
0 Kudos
Message 2 of 7
(3,545 Views)

Great, thanks for responding to my post. I'm using Labview 7.1, I'll have to check to see if it has those .vi's you mentioned. I wonder if it would be easier just to convert the binary to asci and then later to process the asci data. Maybe its easier to seek through an asci file rather than a binary file?

thanks,

joe

0 Kudos
Message 3 of 7
(3,529 Views)

Joe,

also have a look at high speed data logger and high speed data reader Vi's

Here you can store  large binary data and retrieve back in ascii

with a small modification in the reader VI, you can save converted ascii data to a file

you should be able to work it out from that example

if not, do get back

regards

Dev

0 Kudos
Message 4 of 7
(3,515 Views)
I am new to NI and interested in performing bitwise masking to selectively isolate the bytes.  If I have a 32 bits word and only want to keep the high 4 bits of the lower byte, I can mask it with 00F0 in C.  The boolean AND in Labview is logical (0 and 1), not the numeric of the bytes I want.  What do I do? I cannot find bitwise AND operator to yield numerical value I want.  Do I have to use a user defind function control?  Thank you.
0 Kudos
Message 5 of 7
(3,470 Views)
sle,

In the future, please create a new thread for unrelated questions.  To answer your question, you can use "Split Number" from the Data Manipulation palette.




Message Edited by jasonhill on 03-14-2006 03:46 PM

0 Kudos
Message 6 of 7
(3,464 Views)

sle,

You're also incorrect about the AND function. The inputs can be either Boolean or numeric. This is plainly described in the help for the function.

Message Edited by Dennis Knutson on 03-14-2006 03:06 PM

0 Kudos
Message 7 of 7
(3,454 Views)