LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sort a string into an array HELP

I have an output in the form of a string that looks like this  

 

N-150.00E-15,N-49.998E-15,N 150.00E-15,N-99.996E-15,N-49.998E-15,N 0.0000E+00,N 100.00E-15,N-49.998E-15,N-150.00E-15,N-49.998E-15,N 150.00E-15,N-49.998E-15,N-99.996E-15,N-99.996E-15,N 100.00E-15,N-150.00E-15,N-49.998E-15,N-49.998E-15,N 50.000E-15,N 50.000E-15,N 50.000E-15

 

First of all I would like to know how to sort this, I guess into an array, using the commas as the seperators. After that it would be good to loose the N's, then I would like to save the array as a text file or something spreadsheet maybe??

 

I sort of know what I am doing but I need a bit of direction, like what things to use etc..

 

Can anyone point me in the right direction??

 

Thanks

 

0 Kudos
Message 1 of 28
(4,889 Views)

you are on the right track.

 

How do you want to display the info?

0 Kudos
Message 2 of 28
(4,876 Views)

how do you mean?

 

I guess I want to display it like in a spreadsheet so I can import it into excel or other similar programmes, i will need to convert the +E things as well I guess.

 

For now just an output array on the front panel would be nice.

 

Is that what you mean?

0 Kudos
Message 3 of 28
(4,873 Views)

Spreadsheet string to Array using comma as a delimter will produce the array.  So you got that part right.  Then use Sort 1D Array.  To lose the N's you could use String Subset with an offset of 1.  This will remove the first character.  Use either Array to Spreadsheet String to save to a string, or use Write to Spreadsheet File (in file palette) to write the array to a file in spreadsheet format.

 

Your presumptions were correct.  Just learn the functions.

- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 28
(4,870 Views)

looks like a plan, thanks

0 Kudos
Message 5 of 28
(4,862 Views)

The first part would be to convert your string into an array of strings.

You can do that by using the "Spreadsheet String to Array".

 

You can then sort the array as you wish.  Then...

 

0 Kudos
Message 6 of 28
(4,857 Views)

 


@tbob wrote:

Spreadsheet string to Array using comma as a delimter will produce the array.  So you got that part right.  Then use Sort 1D Array.  To lose the N's you could use String Subset with an offset of 1.  This will remove the first character.  Use either Array to Spreadsheet String to save to a string, or use Write to Spreadsheet File (in file palette) to write the array to a file in spreadsheet format.

 

Your presumptions were correct.  Just learn the functions.


 

tbob...

 

You're playing with your ESP gift again.  Better not let Ben catch you 😉  LOL!!

0 Kudos
Message 7 of 28
(4,853 Views)

 


@tbob wrote:

Spreadsheet string to Array using comma as a delimter will produce the array.  So you got that part right.  Then use Sort 1D Array.  To lose the N's you could use String Subset with an offset of 1.  This will remove the first character.  Use either Array to Spreadsheet String to save to a string, or use Write to Spreadsheet File (in file palette) to write the array to a file in spreadsheet format.

 

Your presumptions were correct.  Just learn the functions.


 

tbob...


You're playing with your ESP gift again.  Better not let Ben catch you 😉  LOL!!

 

I hit the post button twice as it seemed to be stuck/frozen..

0 Kudos
Message 8 of 28
(4,852 Views)

I dont get how you've wired up the array type tab

0 Kudos
Message 9 of 28
(4,842 Views)

Are you talking about the empty string array?  On the Array palette you can grab the Array Constant.  It shows up in black on the block diagrm.  Then grab a string constant and drag it into the black box.  Voila.  You have an empty string array.

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 28
(4,825 Views)