LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to split big file?

Hi, folks,

I have a big binary file (around 400M). How can I split it to several small files? If I just use the file read subvi in labview, it will show "not enough memory" error. How can I solve this problem?

Any help will be appreciated!
0 Kudos
Message 1 of 4
(3,113 Views)
> I have a big binary file (around 400M). How can I split it to several
> small files? If I just use the file read subvi in labview, it will
> show "not enough memory" error. How can I solve this problem?
>

This is because you are attempting to read the entire file at once.
File I/O allows you to read anywhere from one byte to the entire file.
I don't know what is in your file, but the read characters from file has
an input for how many characters. Or you can use the more advanced File
Open followed by File Read with specific types wired up.

Either way, determine how you will break it up. 40 10M files, 10 40M
files, etc. Then make a loop where you create the new file, read the
data from the old large file, then write it to the new file, then clos
e
the new file and go to the next iteration of the loop.

Greg McKaskle
Message 2 of 4
(3,113 Views)
Put the read file vi in a loop and read only part of the file each time thru. Due to your memory limitation, you'll have to save them as smaller files. See the attached example which reads n lines of a 1D binary file and auto increments the filename to break a big file into smaller ones.

~Tim
Message 3 of 4
(3,113 Views)
Thanks for your quick reply.

It is very helpful.
0 Kudos
Message 4 of 4
(3,113 Views)