|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Sorting 2-D Arrays [Labview]
I spent about 3 hours today circumventing the idea of sorting 2-D arrays in Labview. I had a 2-D array of 3 values. My plan was to reorder the array by one of the values while keeping the other values in the same index.
For example, this array: [0] 6 14 28 [1] 7 81 4 [2] 1 15 38 I would want to sort it by column 3 making it this: [0] 7 81 4 [1] 6 14 28 [2] 1 15 38 Does anyone know of a simple way to do this, or should I stick with my excessive, hard-to-follow code that I don't think I'll ever understand now that I've finished writing it? |
|
#2
|
||||
|
||||
|
Re: Sorting 2-D Arrays [Labview]
With only three elements, it may be enough to avoid "sorting" sorting altogether, and just use a few IF statements. Not practical for larger sorts, but it might be best in this case.
|
|
#3
|
||||
|
||||
|
Re: Sorting 2-D Arrays [Labview]
have you considered storing the 2d array as a 1-d array of clusters? that way you could store the item you want to sort by in the first slot and just do a 1-d built in sort.
|
|
#4
|
|||
|
|||
|
Re: Sorting 2-D Arrays [Labview]
Quote:
Thanks. |
|
#5
|
|||
|
|||
|
Re: Sorting 2-D Arrays [Labview]
Unfortunately, there is no easy way to tell LV exactly how to sort more complicated data containers. LV deals with almost any type, but only 1D containers, sorted by first, then second, etc, and only in ascending order.
The attached snippet shows how to build an index array, then rebuild the 2D array based upon the indices. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 2008 Match Sorting Algorithm | Grant Cox | Rules/Strategy | 1 | 09-01-2008 21:41 |
| Sorting out Digital NASA TV | Billfred | General Forum | 2 | 03-12-2007 18:55 |
| pic: Sorting drill bits | Andy Baker | Extra Discussion | 12 | 16-02-2005 21:46 |
| Arrays on the PIC? | scitobor 617 | Programming | 8 | 06-12-2004 09:10 |
| EduCAD and Arrays!!!!! | Sachiel7 | Programming | 14 | 03-11-2003 03:21 |