LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert varying hex string to array of 8 and 16 bit numbers

Hi
 
I have a data string that I'm reading from a file.  The format of the string is as follows:
 
a bB cC dD eE fF gG hH iI j kK/r
 
each letter is an 8 bit character.  The capitol letters are high bit of a 16 bit number.
 
I have a sample that works.  It converts all the characters to an array with eleven rows.   My problem is my files usually have a million data points or more and it takes a while for my VI to execute. 
 
I've attached a sample file and an example VI with 3 possible solutions.
 
Case 0 ran in about 4.5 sec on my computer
Case 1 ran in about 4.2 sec
Case 2 ran in about 10 sec
 
If anyone has an alternative solution I'm open to some advice.
Thanks in advance
 
Eric
 
Labview 7.1 / WinXP SP2
 
 
 
0 Kudos
Message 1 of 4
(3,827 Views)

Hi Eric,

I took a look at your VI and didn't see any major places you might be able to program more efficently.  I guess my real question would be were did the data come from?  Perhaps you could do a sort of initialization were you convert the values to a 16 bit number and write this to a file.  Then later you could access the new file in terms of the 16 bit numbers.  That may be a little quicker than having to read 8 bits and convert to 16 bits ( of course if the 8 bit data is generated new all the time this might not be useful ).

Regards,

Steve B.

Message Edited by Bassett Hound on 09-26-2006 05:54 PM

Message 2 of 4
(3,792 Views)
Hi Steve
 
Thanks for your reply.  You hit the nail on the head.  The idea would be to make all the values 16 bit numbers.  My biggest struggle was trying to figure out how to operate on more than one line at a time.  If I could convert a big group of data that would make things more efficeint.  I came across this thread:
http://forums.ni.com/ni/board/message?board.id=170&message.id=204627&a  and the post from altenbach made perfect sense.
 
If I reshape my array I could operate on more than one line at a time.
 
The solution I came up with executes in 600 ms as opposed to 4 sec with my previous example.
 
I hope this will help somebody else.
 
Eric
0 Kudos
Message 3 of 4
(3,777 Views)
That a great speed improvement Eric.  Altenbach defintely has some good posts on the fourms too.  Good luck with the rest of your application.
 
Steve
0 Kudos
Message 4 of 4
(3,772 Views)