Bobillier Posted June 26, 2007 Report Share Posted June 26, 2007 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 Quote Link to comment
orko Posted June 26, 2007 Report Share Posted June 26, 2007 QUOTE(BOBILLIER @ Jun 25 2007, 09:54 AM) 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 . I don't know if this is the best way, but off the top of my head here's a way to do what I think you want: http://forums.lavag.org/index.php?act=attach&type=post&id=6212''>http://forums.lavag.org/index.php?act=attach&type=post&id=6212'>http://forums.lavag.org/index.php?act=attach&type=post&id=6212 Quote Link to comment
Michael Aivaliotis Posted June 26, 2007 Report Share Posted June 26, 2007 you can avoid the search if you just want to sort. http://forums.lavag.org/index.php?act=attach&type=post&id=6213 Quote Link to comment
orko Posted June 26, 2007 Report Share Posted June 26, 2007 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. Thanks for the tip, Michael! :thumbup: Quote Link to comment
Grampa_of_Oliva_n_Eden Posted June 26, 2007 Report Share Posted June 26, 2007 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 Quote Link to comment
orko Posted June 26, 2007 Report Share Posted June 26, 2007 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 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. 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! Quote Link to comment
Michael Aivaliotis Posted June 26, 2007 Report Share Posted June 26, 2007 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? Quote Link to comment
orko Posted June 26, 2007 Report Share Posted June 26, 2007 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: Quote Link to comment
Aristos Queue Posted June 26, 2007 Report Share Posted June 26, 2007 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. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.