LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I need to convert the string representation of 10, 11...15 to A, B...F?

Hi,
 
I have a channel list that will be in the representation like the following "0, 1, 2, ... 14, 15" in string format.  Of course i won't always be using all the channels so sometimes it might be "2, 5, 15" or "15" or "".  It all depends on the channels that I need to use.  Anyways, using TestStand I need to run a for loop for that runs through the channels and finds the matching string in the channel list then run some more code....Like so:
 
ChnlList = "1, 2, 3, 11, 15"
 
For(Chnl = 0, Chnl <=15, Chnl ++)
     {
       If(Chnl is in ChnlList)
          { Then execute this code}
     }
 
I hope that makes since.  I've tried to take the ChnlList string and converting it to decimals that i could use but can't seem to get it into the right format.
 
My orginal plan was to convert Chnl to a string and search for that string in the ChnlList in TestStand, but that wouldn't work becasue if Chnl = 1 and ChnlList = 15 then it would execute.
 
So i moved onto Labview to try and do some converting of that string but I'm struggling to get it into something I could use.  Any of you smart guys have any ideas?
 
Thanks,
also i'm using LV 8.2, TS 3.5
0 Kudos
Message 1 of 6
(2,768 Views)
How about using the 'Decimal String to Number' vi followed by the 'Number to Hexadecimal String' vi?
0 Kudos
Message 2 of 6
(2,762 Views)
Easiest would be to use "spreadsheet string to array" (with a comma as delimiter and a 1D integer array as type). Now you can just autoindex the resulting integer array into a FOR loop to process the channels.
 
Here's a quick draft (LabVIEW 8.2).
 
 
It is not very reasonable to carry the channel list around as strings. Once they are integers, the formatting (decimal, hex, etc.) is just a cosmetic issue of the indicator and irrelevant for the code.

Message Edited by altenbach on 09-01-2007 08:45 AM

Download All
0 Kudos
Message 3 of 6
(2,733 Views)
Thanks for the help guys, but both of these outputs strings. In order for me to have some sort of number to compare with my loop in TestStand I need something that will convert it to a real decimal number or a real hex number.
0 Kudos
Message 4 of 6
(2,678 Views)
No. The blue array going into the FOR loop in my example are the numbers you want. Look at it again! 🙂
0 Kudos
Message 5 of 6
(2,669 Views)
Yeah i figured that out pretty much right after I sent the post..oppsSmiley Very Happy
0 Kudos
Message 6 of 6
(2,665 Views)