|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#16
|
||||
|
||||
|
Re: Basic Labview Programming Questions
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.
. I have attached the vi.Thanks. |
|
#17
|
||||||
|
||||||
|
Re: Basic Labview Programming Questions
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. Last edited by Joe Ross : 12-10-2008 at 15:24. |
|
#18
|
||||
|
||||
|
Re: Basic Labview Programming Questions
Quote:
|
|
#19
|
|||||
|
|||||
|
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.
|
|
#20
|
|||||
|
|||||
|
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. |
|
#21
|
|||
|
|||
|
Re: Basic Labview Programming Questions
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A few Labview questions | Japper | NI LabVIEW | 14 | 09-09-2008 20:41 |
| A few basic EasyC Pro questions | Joe G. | Programming | 5 | 11-03-2008 21:18 |
| Some Basic Questions... | bglass | Motors | 5 | 02-07-2007 21:53 |
| BASIC programming | John Gutmann | Programming | 3 | 17-05-2005 12:15 |
| Very Basic Programming Question | kewlkid382 | Chit-Chat | 5 | 18-01-2003 11:11 |