LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parsing a string into a multicolumn list box

Hi,

I have enclosed a copy of the string that the AWG puts out when I send the command to view its directory.
However the format, 1 single string is not very user friendly and I need to parse this data to a multicolumn listbox.
Please find enclosed what I am trying to accomplish.

Help is much appreciated.
0 Kudos
Message 1 of 9
(3,823 Views)
You can use String to Spreadsheet array to get a string array. I seems that every item is spearated by a comma so use that as a delimiter. Once you've gotten the 1D array, you can extract the elements you want with the index array and create a 2D array that you write to the Item Names property node of the mulitcolumn listbox. Try it and if you have problems, post the code you've written.
Message 2 of 9
(3,814 Views)
Good idea.  Never thought about using a string to spreadsheet array.
Thanks again.
0 Kudos
Message 3 of 9
(3,801 Views)
Hi,

I am running into a little bit of a problem.
My parsing code works, however when I try to re-organize the names in alphbetical order, it does not work. 
The N comes before f.

Enclose is a copy of my code.
0 Kudos
Message 4 of 9
(3,793 Views)

Hello,

The Sort 1D Array function treats strings as their ASCII hex values...thus, 'F' and 'f' have different values, and this is reflected in the sort.  The easiest way to fix this would be to add a third element to the beginning of the cluster, and this would be your string, but converted to all lower case.  The Sort 1D Array would then sort based on that lowercase string.

Hope this helps,

-D

0 Kudos
Message 5 of 9
(3,784 Views)
I can't do much without the read buffer string. When you run it again and have data in the control, right click on it and select Data Operations>Make Current Value Default. Save the VI and re-post it.
0 Kudos
Message 6 of 9
(3,784 Views)
Sorry for the inconvience

0 Kudos
Message 7 of 9
(3,778 Views)
Darren is correct. This is the way string sorts work. The ASCII value for capital N is x4E and the ASCII value for small f is 66 so the sort is correct.
0 Kudos
Message 8 of 9
(3,769 Views)
Put a case change, either all upper or all lower, in front of the array sort.  Since you are sorting a copy and only using it to provide idexes for the next for loop, the case will be preserved in the final result.


Message Edited by jasonhill on 01-27-2006 02:37 PM

0 Kudos
Message 9 of 9
(3,765 Views)