DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with a sort function under Diadem 9.1

Hey,
 
I have a problem with the CHNMULTIPLESORT function.
 
I have two channel´s which contains the following values.
Channel 1     Channel 2
1                    1
2                    1
3                    1
1                    2
2                    2
3                    2
1                    3
2                    3
3                    3
 
if I use the CHNMULTIPLESORT with channel1 and channel2
the result is:
x_sort         y_sort
1                 3
1                 1
1                 2
2                 3
2                 2
2                 1
3                 2
3                 3
3                 1
 
but I expected
x_sort         y_sort
1                 1
1                 2
1                 3
2                 1
2                 2
2                 3
3                 1
3                 2
3                 3
 
Is the a script which repairs the bug?

Thanks
 
0 Kudos
Message 1 of 3
(3,477 Views)
Hello lai!
 
DIAdem just use Channel1 for sorting. If there are equal values in this channel the result is unpredictable.
 
Unfortunately there is no alternativ. A workaround (depending on the value ranges of the two channels) is to generate an additional temporary channel for sorting. One approach is to multiply the values of Channel1 with a constant value bigger than the biggest Value in Channel2 and add the corresponding Channel2 value to this. Note: This works only for positiv values in both channels!
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
0 Kudos
Message 2 of 3
(3,465 Views)

Hi lai,

You may want to consider creating a new "Sorted Values" group and sending each set of 3 rows from channel 2 to a new channel in this new group.  It depends what you want to do with this data.  If you want to plot each set of 3 rows as a different curve on a graph, then this would be the right approach.  If you want to calculate statistics on each set of 3 rows, then you don't have to do this (nor the sorting).

If you just want to see the data displayed this way in a table, then I'm afraid you're going to have to use a VBScript to do the sorting cell by cell.  The easiest way to do this is to use a bubble sort algorythm, since you can run it once for the channel 2 values and a second time for the channel 1 values and get the two-level sorting that you're after.

Will you ever need to do this with more than 2 channels?

Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 3 of 3
(3,456 Views)