LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fast sort of a big 2D array of strings ...

Hi

I'd like to sort an big array of strings. My problem is that I need to sort it by columns, which means that I cannot use the included Sub-VI 1D-Sort. I downloaded a Sub-VI which does a Bubble Sort, it just works great, but since I have more than 2000 rows, the bubble sort is just too slow.

My Question now is, if somebody out there did already rebuild a quicksort in LabView. I think it has to be an DLL or a CIN function, because LabView doesn't allow recursive calls.

Thanks, Frank
0 Kudos
Message 1 of 6
(5,146 Views)
knarf,

Would tranposing the VI help - so that the sort is then by rows, not columns?

Also/or, here's a link to recent responses related to same subject, with an attached VI for large sorts of 1D & 2D arrays.

http://exchange.ni.com/servlet/ProcessRequest?RHIVEID=101&RPAGEID=135&HOID=5065000000080000009C240000&UCATEGORY_0=_49_%24_6_&UCATEGORY_S=0

Good Luck,
Doug
0 Kudos
Message 2 of 6
(5,146 Views)
> I'd like to sort an big array of strings. My problem is that I need to
> sort it by columns, which means that I cannot use the included Sub-VI
> 1D-Sort. I downloaded a Sub-VI which does a Bubble Sort, it just works
> great, but since I have more than 2000 rows, the bubble sort is just
> too slow.
>
> My Question now is, if somebody out there did already rebuild a
> quicksort in LabView. I think it has to be an DLL or a CIN function,
> because LabView doesn't allow recursive calls.
>

If the bubble sort is just a bit slow, you may want to modify it
to be a selection sort. Still a simple algorithm. It has the same
number of comparisons, and way fewer assignments.

Selection sort is really simple to implement. Search for the largest
item. Swap the last item with
the largest. Next iteration of the
loop, you leave out the last item. This will be faster than bubble
sort, but will not be as fast as quicksort.

Quicksort can be implemented without recursion. I don't have one
at my disposal, but it is pretty straightforward using a shift-
register to hold the items that still need to be looked at.

Greg McKaskle
Message 3 of 6
(5,146 Views)
Hi, Please help me to put the data from an initial array obtained by repeating writing into excel file (see fig 1) Initial = 2columns of repeated 3 times measurements groups In an excel /array final file with next format (see.fig.2) Final 4 columns array (= 1column for variable and 3 columns for each 3 repeated measurements) Thanks, Mabel
0 Kudos
Message 4 of 6
(3,919 Views)

You are replying to a 9-year old thread. Might as well have been written before the Dark Ages.

 

You should start a new thread with your question. You should also provide information on what should happen should there not be exactly 3 matches for each value.

0 Kudos
Message 5 of 6
(3,900 Views)
Hi, Thanks for rapid answer. I don’t know to post my question as a new subject in this forum…, but better I will describe more carefully my problem. The measurement system uses a main variable (V1 having N_V1 measurement points ) and a secondary variable (V2 having N_V2 measurements steps). The measurements are performed varying V1 in a loop of NV2 steps of V2 variable. The measurements are easy saved writing data in an appended excel file. In order to obtain a better representation form of these data it must sorted them after V1 values only while the V2 values will be the labels of each set of V1.. In figures 1 and 2 there are a 4meas.steps of V1 and 3meas.steps V2 results in initial and intended final excel file( in final form(fig2)I didn’t include the labels for V2) Regards, Mabel
0 Kudos
Message 6 of 6
(3,869 Views)