LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recursive VIs


@SarmaHari wrote:

Replying to Ben (message 5)

Please find attached a quick recursive vi (re-entrant) saved for LabVIEW Version 15. Very basic, not much of error handling etc., 

- "open a reference to the target VI ", would  obviously fail, if I rename a vi. 

On my present computer, I do not have NXG , so can not  give a copy. However I tested. As the behavior of CG & NXG LV's different, when copying a recursive file at Windows (OS) level, I see the following problem

1. If there is a set up  that, has set of shell scripts (or batch files or any scripting language files) that rename ("ren" in windows , "mv" in Linux) a recursive file and executes, in this kind of  setup, changing CG LV to NXG LV files would not suffice. Changing the script is also required

2. Assuming Nestedness (stack depth) of recursive file is same in CG & NXG, NXG would  go one more level extra. That is because NG first invokes new file, which invokes old (before renaming) file


You've lost me there.

 

 

0 Kudos
Message 11 of 14
(574 Views)

wiebe@CARYA wrote:

@SarmaHari wrote:

Replying to Ben (message 5)

Please find attached a quick recursive vi (re-entrant) saved for LabVIEW Version 15. Very basic, not much of error handling etc., 

- "open a reference to the target VI ", would  obviously fail, if I rename a vi. 

On my present computer, I do not have NXG ,...


You've lost me there.

 

 


I am confused as well. Is this an issue with NXG?

 

I am not of much help with NXG since I never actually touched it.

 

Spoiler

 

Somehow the new look and feel makes me cringe. I get the impression my nice fine point pen is replaced with crayons and the hidden config of every widget hides the implementation requiring I poke at everything making "reading the code at a glance" as we can do with CG. And then there is that waste of screen with those silly windows ... Boy have I digressed!

 

 

 

Now to offer the "old-school" approach to recursion in LabVEW. In this Nugget I wrote about control refs and offered an approach that let us navigate into undefined nested arrays of clusters in arrays etc. Here is a screen shot from that Nugget.

 

Figure_18_Save_Cluster.PNG

 

As shown the VI opens a ref to itself and then invokes itself.

 

Speaking about CG...

 

I usually avoid recursion since it is hard to follow ( for me), incurs memory overhead for each recursion, and the last time I checked, abort a VI after single stepping into the stack would crash LV.

 

Not sure if any of that helps but sometimes just scattering ideas helps.

 

Ben 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 14
(562 Views)

Almost on-topic: When did LabVIEW (version?) allow the VI to call itself directly without invoking it?

Brian Smith
Advanced Light Source
Lawrence Berkeley National Laboratory
0 Kudos
Message 13 of 14
(511 Views)

@BVSmith wrote:

Almost on-topic: When did LabVIEW (version?) allow the VI to call itself directly without invoking it?


If I had to guess 7 or 8.

0 Kudos
Message 14 of 14
(488 Views)