06-20-2019 10:47 AM
good morning, I'm performing three Vi consisting of a main, and two sub VI, in the first sub VI the values are entered using a structure event in which every time the button is priced it stores the value in a vector, the next Sub VI takes that vector and sorts it from less than large, but this sub VI must have recursion to sort the vector, the vector entered in clutter and ordered is shown in the main VI. my drawback is that I don't know how to develop recursion maybe you can help me please. attached my files
Solved! Go to Solution.
06-20-2019 11:48 AM
There is no need to use recursion for this unless this is a class assignment or homework. Can you clarify the purpose of this exercise?
06-20-2019 11:56 AM
It's a Homework
06-20-2019 12:00 PM
06-20-2019 12:12 PM
I must enter the elements to the vector just by pressing the button, I do not have much knowledge but I am trying to make it work, if you can help me thanks is very useful for me, my desire is to learn and if there is a better way please teach me
and to order the vector it can be in any way but it must have recursion, only in the VI of ordering the vector
06-20-2019 12:31 PM
@Nolbert wrote:
I must enter the elements to the vector just by pressing the button, I do not have much knowledge but I am trying to make it work, if you can help me thanks is very useful for me, my desire is to learn and if there is a better way please teach me
You need to initialize the shift register with an empty array, then append with each click.
For the recursive bubble sort, the code can be 10x less complicated than what you have now. I just made one and it works well. Also make sure to measure the array size instead of using fixed diagram constants. The recursive sorting needs to ultimately work for arrays of any size.
06-20-2019 12:41 PM
maybe you can help me with an image of how I develop the recursive method
06-20-2019 12:42 PM
I guess you got a solution. Here's what I just made up from scratch. 😉
I won't attach any code and you still need to guess what's in the other case of the case structure. 😉
06-20-2019 12:52 PM
Thank you
06-20-2019 02:59 PM
this is fine to enter the data, or it is very extensive, and about the other case in the structure I still think, a question in the case of the photo is only to work on the first number? because I get a vector of zeros at the end does not take not the first value or is it the other case ??