LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to separate values from data in 1d array

Hello,

          I was wondering how to separate values from 1 column to 2 columns

                                       for example,  1d array gave 100,300,103,304,301,104,...

                                                                                    to 100,103,104

                                                                                  and to 300, 304, 301,..

0 Kudos
Message 1 of 19
(5,278 Views)

You could start by feeding your array into the sort 1d array function. This will put the array elements into ascending order. From there use the search 1d array to get the index of the element you want to split the array at. Then use the split 1d array.

hope this helps.

Now Using LabVIEW 2019SP1 and TestStand 2019
0 Kudos
Message 2 of 19
(5,258 Views)
Do you know the indices you want to split, or do you want to split the 100s from the 300s? See the code attached.
Download All
Message 3 of 19
(5,256 Views)

I do not want to sort them in a acending/decending mode. I would like to sort them in real time.

 

 

I'm using labview 8.2 and I cant read the files.

 

Thanks

 

0 Kudos
Message 4 of 19
(5,234 Views)

How was the file formatted?

It sounds like the file was a 2-d array, how did it end up 1-d?

In any event, have a loop iterate through every other value and put it in a 1-d array.
Then put the remaining values in a seperate 1-d array.

Cory K
0 Kudos
Message 5 of 19
(5,214 Views)

I have not optimized the code (it's a bit slow).  Is this what you are looking for?

See attachment in LV8.2

 

It does not sort the arrays but splits them in the order as they are found.  The front part of the code is to generate 500 random numbers in two groups 100 to 109 & 300 to 309, to represent the numbers you have shown.

 

R

 

EDIT:  Question:  When you say "split in real time", are the numbers already into an array or it is prior to being in an array?

Message Edited by JoeLabView on 09-11-2008 01:47 PM
Message 6 of 19
(5,213 Views)

thanks for the code . it is working.

ps how does one incdlue > and <   for sorting ?

 

0 Kudos
Message 7 of 19
(5,151 Views)

Can you provide more details about what you mean on the Greater / Smaller than.. 

 

How do you want this comparison to be done?

 

R

Message 8 of 19
(5,089 Views)
to differentiate them, use " In Range and Coerce" function. Use a FOR looping. :robotwink:
0 Kudos
Message 9 of 19
(5,084 Views)
How will "In Range and Coerce" do the trick if we do not know what is needed?  LOL! 😄
Message 10 of 19
(5,064 Views)