![]() |
Re: Basic Labview Programming Questions
1 Attachment(s)
I am trying to write a Labview vi that takes a one dimensional numerical array, for example A= 5,4,3,2,1, and sorts the values in ascending order. We do not want to use the sort array operator since the whole purpose is to practice using labview. Although I can write this no problem using Basic, I am having trouble in Labview. :confused: . I have attached the vi.
Thanks. |
Re: Basic Labview Programming Questions
1 Attachment(s)
Quote:
You'll need another loop of some type to finish sorting. You can also use the array size VI for the input to the count terminal input of the for loop. |
Re: Basic Labview Programming Questions
1 Attachment(s)
Quote:
|
Re: Basic Labview Programming Questions
Well that last VI is mostly correct, aside from either a second FOR loop to run it n-1 times, or a while loop that will stop if it didn't make any swaps in the last run of that inner FOR loop... But seeing Bubble Sort implemented in Labview seems very very wrong to me. There's a reason NI has VIs like this already made, after all.
|
Re: Basic Labview Programming Questions
Quote:
But I think sorting is the kind of operation that should be implemented by people having deep knowledge of the runtime environment, and not used as an exercise in learning how to use a data-driven programming language. |
Re: Basic Labview Programming Questions
1 Attachment(s)
If this is for learning purposes, then I see nothing wrong with it. In fact I've attached a few other implementations of sort, which will hopefully show some of the tricks and syntax with arrays as well as the relative performance.
[ATTACH]More sorting[/ATTACH] If you decide to use a Bubble Sort on your robot, well then perhaps you'd like to build your own chain too. Greg McKaskle |
| All times are GMT -5. The time now is 11:30. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi