LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Number Array VI wont work backwards!

Why wont this VI work when you set it to go from say 20->-60??

0 Kudos
Message 1 of 22
(3,461 Views)

Scrap that... I can see why, but how do I modify it?

0 Kudos
Message 2 of 22
(3,458 Views)

Flip-flop you start and end then use "reverse Array" function from the array palette.

 

For those that don't want to peek at the code...

 

Recursive VI that calls itself as long as we have not reached the end. It assumed all posive values so this check fails and the recursion never happens.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 3 of 22
(3,447 Views)

I rarely use recursion because I find it hard to follow in most cases, and in most cases it uses more resources than it has to.  So attached is the While Loop recursion method that doesn't call it self over and over.  It also uses the auto index function so there are no build array functions.

 

I've also added a Min/Max function that ensures that the Start is before the End.

0 Kudos
Message 4 of 22
(3,433 Views)

That is good and all, but what if I want my array to come out with the larger number first?

0 Kudos
Message 5 of 22
(3,421 Views)

Which I do

0 Kudos
Message 6 of 22
(3,420 Views)

I made this, but don't know how to make it recursive...

0 Kudos
Message 7 of 22
(3,418 Views)

As the original context shows, this VI is a toy aimed to show the principles behind native recursion and not to replace the loop construct.  The Ramp.VI in the signal generation palette is a perfectly suitable solution for the real application.  For the much more interesting academic exercise, the recursive VI should be modified at will.

 

That particular VIOTD did not generate much excitement, so I guess it wasn't explored much then.  

 

Spoiler

Every now and then when I revisit one of those threads I start to get the itch again.

 

 

0 Kudos
Message 8 of 22
(3,417 Views)

Anyone got any more Ideas

 

Nothing has really worked yet

0 Kudos
Message 9 of 22
(3,393 Views)

There was no original context with this post.  I had no idea that it was intended to show LabVIEW's recursive feature.  That being said if you want the larger number first just reverse the array at the end, it's a native function in the array palette.

0 Kudos
Message 10 of 22
(3,391 Views)