Jump to content

Sort (search) Array of cluster by one cluster element


Recommended Posts

Hi all

I want to find the best way to sort (search) array element of cluster by one of the element of this cluster. and obtain a array of index .

Actualy the search element of openg do that for a cluster elemnt but not for element of cluster.

I want a generic solution and thinking pass by variant, but i have look around and a bit lost my latin ;-).

Please show me draw and don't send me directely VI because y work on 7.0 and can't open higher.

thanks

Link to comment

QUOTE(Michael_Aivaliotis @ Jun 25 2007, 10:16 AM)

you can avoid the search if you just want to sort.

Well...you learn something new every day. I had no idea that "Sort 1D Array" will compare the first element of a cluster when sorting an array of clusters. :book:

Thanks for the tip, Michael! :thumbup:

Link to comment

QUOTE(orko @ Jun 25 2007, 01:21 PM)

Well...you learn something new every day. I had no idea that the "Sort 1D Array" will compare the first element of a cluster when sorting an array of clusters.

Thanks for the tip, Michael! :thumbup:

and....

if your cluster have arrays, it will sort them as well.

Tie-breakers use the second element of the cluster and so on....

Ben

Link to comment

QUOTE(Ben @ Jun 25 2007, 10:24 AM)

and....

if your cluster have arrays, it will sort them as well.

Tie-breakers use the second element of the cluster and so on....

This had me blinking :blink: until I realized you meant "if your cluster have arrays, it will sort by them as well." I couldn't figure out how the sort 1D array was going to sort arrays inside an array of clusters. :wacko:

That's pretty cool though. I just tried it out and sure enough, with an array as the first element in the cluster, the sort will sort by the array's first element, then second, and so on. Thanks for this tidbit as well!

Link to comment

QUOTE(Michael_Aivaliotis @ Jun 25 2007, 10:45 AM)

Btw, I really don't like that yellow background on the diagram. It doesn't feel right. Or is it just a side effect of the gif transform?

Hehe... well, it's both actually. The yellow that I have on my BD is a lot lighter, almost white but just enough of a tone to not blind me when I open up my code in a dark environment. I'm one of those that is accustomed to black-lit workspaces. Comes from long hours as a web developer at eAcceleration, where flourescent lighting was an evil demon that drained the lifeforce from you after 18 hours of crunch time coding. I worked in an area that we dubbed "The Dark Side" :ninja:

Link to comment

I'm pretty sure that OpenG has some better array sorting/searcing VIs that let you pass in a VI Server reference to do the comparison, so you just write a compare function that compares the desired element of the cluster and returns greater, equal or less. I saw something like that on Jim Kring's screen when he won the LV speed programming competition at NI Week a couple years ago.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.