LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting array

Solved!
Go to solution

I know how to sort the array of strings alpha numerically but my problem is that the numerical values will not follow there corresponding strings

 

here is the code i am using:

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 1 of 6
(3,963 Views)
Attach ur input files.
Balaji PK (CLA)
Ever tried. Ever failed. No matter. Try again. Fail again. Fail better

Don't forget Kudos for Good Answers, and Mark a solution if your problem is solved.
0 Kudos
Message 2 of 6
(3,961 Views)
Solution
Accepted by Harold_Timmis

Well, assuming that the two arrays are of equal size, you would bundle in a FOR loop, sort, the unbundle in a second FOR loop, e.g. as follows:

 

 

This takes advantage of the fact that arrays of clusters are sorted according to cluster order.

Message Edited by altenbach on 04-02-2009 10:31 PM
Message 3 of 6
(3,951 Views)

It worked perfectly, I did try this except I tried it with a case statement not a good idea lol

 

thanks

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 4 of 6
(3,935 Views)

Hi.

 

It's nice to have "sorting array" icon.

But I have problem with programming similar option. I want to sort my sine samples taken in more periods to just one period.

Beside defining that mycurrent sample should be less than next one, and greater from previous one in one case, I should take in consider that derivation could be positive or negative. While negative derivation, next sample should be less then current and so one.

Can someone help me with programming?

 

I've extracted the first period, and then I have to go trough each sample and compare him. When logic is well,I get the index and putinsert elemt in array.

 

I think that I'm having problem with while loops. I don't know where to put them.

 

I'm attaching VI. beacuse I'm working on Labview 9.0, I'm attaching also a pic.

 

Thanks in advance.

Download All
0 Kudos
Message 5 of 6
(3,604 Views)

Tina

 

I don't quite see what your problem has to do with sorting, so please start a new thread instead of adding to an old thread that is already marked as solved.

 

(You seem to have some basic misunderstanding of local variables. A local variable just points to a control or indicator, so writing to an indicator and to a local variable of the same indicator makes no sense. You also introduce a race condition, because there is no quarantee that the reading of the index local occurs after writing to the terminal. If it occurs first (very likely!), your results will be wrong. Eliminate the locals and just branch the blue wire!)

Also your sequence frames have no purpose. Execution order is fully determined by dataflow just fine. Why clutter the diagram?
Message Edited by altenbach on 01-20-2010 11:14 AM
0 Kudos
Message 6 of 6
(3,590 Views)