LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there any method to compress a string in LabVIEW?

Can we compress a string in LabVIEW?
0 Kudos
Message 1 of 4
(4,022 Views)
A string is a series of bytes representing ASCII characters. If you want to compress the amount of bytes it uses, here's an idea:
Assuming your string uses a limited character set, you can convert your letters to a 7-bit (or even 6 bit, if you give up capital letters) represention of your own making (let's say that '0' [48 ASCII] is 27 in your representation and not 48), thus saving a bit (or 2) off each byte. You can use the String to Byte Array VI and then the Number to Boolean Array VI.
Now you have an array of bits in which each 6 bits is a character. Break the array into groups of 8 bits, transform it back to a string and (hopefully) you've compressed the string by a quarter.
When you want to decompress, you'll need to reverse the process.
I haven't thought it through, and it probably needs some more work, but I think the basic idea should work.

___________________
Try to take over the world!
0 Kudos
Message 2 of 4
(4,011 Views)
0 Kudos
Message 3 of 4
(3,996 Views)
Hi Alan;

You can obtain a very nice compression package at OpenG.org (I know is somewhere there, but because they recently changed the website, I was unable to quickly find it. You may want to contact Jim Kring (mainly here) on how to obtain it.)

Regards;
Enrique
www.vartortech.com
0 Kudos
Message 4 of 4
(3,985 Views)