Check out our VI Scripting Code Repository Files and visit the LabVIEW Wiki VI Scripting article
Tags |
(This content has not been tagged yet)
|
![]() |
Oct 13 2006, 03:07 PM
Post
#1
|
|||
![]() Extremely Active NI ![]() Posts: 607 Joined: 8-December 03 From: Dallas, Texas Member No.: 208 Using LabVIEW Since:2000 LV:8.6 ,8.2.1 ,7.1.1
My Gallery
|
I just had one of those eureka! moments when pondering the implementation of recursive calls.
I know that it does not take much effor to recurse a VI ![]() But what about a vi that automates the process for you and wraps it up into a neat little sub-vi here is my vision which I don't have time to complete but I belive that the community could easily wrap their wires around Create a VI that when dropped into a BD will do the following
whatdaya think!!! -------------------- Norman J. Kirchner Jr.
Automation Software Engineer ~,~ The Captain Was Here Premium Blend ![]()
|
||
|
|
|||
| Ad |
Oct 13 2006, 03:07 PM
Post
#
|
||
|
|
|
||
|
|
|||
Oct 13 2006, 03:46 PM
Post
#2
|
|||
![]() I'm a LAVA, not a fighter. V I Engineering, Inc. ![]() Posts: 3849 Joined: 13-October 03 From: Michigan, USA Member No.: 181 Using LabVIEW Since:1993 LV:8.5 ,. ,.
My Blog
|
That's just crazy enough to work!
-------------------- ![]()
|
||
|
|
|||
Oct 13 2006, 03:52 PM
Post
#3
|
|||
![]() Extremely Active NI ![]() Posts: 607 Joined: 8-December 03 From: Dallas, Texas Member No.: 208 Using LabVIEW Since:2000 LV:8.6 ,8.2.1 ,7.1.1
My Gallery
|
I'm thinking also that we could use express technology to accomplish this because it does the creation of a sub-vi for you w/out needing to make new files.
For those of you who are savvy to the express world. We have the ability to modify the source when running the configure vi. So when the express is configured (either automatically when dropped or when told so by the user) would be to modify the source VI to have the same inputs as the caller and drop the vi-server recursion fuctions in the guts. oooooh I'm liking this. -------------------- Norman J. Kirchner Jr.
Automation Software Engineer ~,~ The Captain Was Here Premium Blend ![]()
|
||
|
|
|||
Oct 13 2006, 04:08 PM
Post
#4
|
|||
![]() Very Active Member Posts: 165 Joined: 9-February 05 From: region Eindhoven, the Netherlands Member No.: 1555 Using LabVIEW Since:2008 LV:7.1.1 ,8.5.1 ,8.2.1
|
For those of you who are savvy to the express world. We have the ability to modify the source when running the configure vi. So when the express is configured (either automatically when dropped or when told so by the user) would be to modify the source VI to have the same inputs as the caller and drop the vi-server recursion fuctions in the guts. Hey that sounds very interesting ! So you can create the correct connector pane constant ! I've been waiting for that for quite some time... Can you create such a constant given a non-typed VI ref ? Joris
|
||
|
|
|||
Oct 13 2006, 04:18 PM
Post
#5
|
|||
![]() Extremely Active JKI ![]() Posts: 624 Joined: 19-June 03 From: Bay Area, CA (USA) Member No.: 121 Using LabVIEW Since:1998 LV:8.5.1 ,8.6 ,8.2.1
My Blog
|
I'm thinking also that we could use express technology to accomplish this because it does the creation of a sub-vi for you w/out needing to make new files. I think an externalNode (XNode) will be better for that, because, as you modify the connector pane of the parent, the connector pane of the child (the recursive call subVI) should modify itself as well.For those of you who are savvy to the express world. We have the ability to modify the source when running the configure vi. So when the express is configured (either automatically when dropped or when told so by the user) would be to modify the source VI to have the same inputs as the caller and drop the vi-server recursion fuctions in the guts. oooooh I'm liking this. Edit: Another benefit is that you would not even need to create a SubVI in your project folder. The code would be right there behind the XNode. PJM --------------------
|
||
|
|
|||
Oct 14 2006, 02:48 AM
Post
#6
|
|||
![]() Confucius say: Crowded elevator always smell different to midget Admin ![]() Posts: 2402 Joined: 13-October 02 From: Planet Earth Member No.: 2 Using LabVIEW Since:1994 LV:8.5 ,8.2.1 ,7.1.1
My Blog
My Gallery
|
-------------------- Thank You
Michael Aivaliotis - Follow me on Twitter - My Personal Blog Search the LabVIEW Web - Build the LabVIEW Web - Got VIPM? ![]()
|
||
|
|
|||
Oct 15 2006, 01:40 AM
Post
#7
|
|||
|
Changing the world, one VI at a time. JKI ![]() Posts: 1717 Joined: 22-October 02 From: San Francisco, CA Member No.: 17 Using LabVIEW Since:1995 LV:8.2.1 ,8.5 ,7.1.1
My Blog
My Gallery
|
I think an externalNode (XNode) will be better for that, because, as you modify the connector pane of the parent, the connector pane of the child (the recursive call subVI) should modify itself as well. Edit: Another benefit is that you would not even need to create a SubVI in your project folder. The code would be right there behind the XNode. PJM I like this idea! --------------------
|
||
|
|
|||
Oct 15 2006, 02:28 AM
Post
#8
|
|||
![]() LV R&D Envoy NI ![]() Posts: 1275 Joined: 15-August 06 From: Austin, TX Member No.: 5877 Using LabVIEW Since:2000 LV:8.6 ,6.0 ,.
My Gallery
|
I think an externalNode (XNode) will be better for that Quick safety tip for all you who seek to peek under the skirts of LV: external nodes and XNodes are not the same thing, though they both serve the same goal. External nodes were LabVIEW R&D's first attempt at nodes that script themselves. They have issues and have been supplanted by XNodes, our second attempt. XNodes are better, in theory*. *"In theory", from the Latin "en theos" meaning "with God" or, more specifically, "assuming He Who Built The System doesn't change His mind." -------------------- "A VI outside a class is a gun without a safety. Data outside a class is a target."
--- A message from LabVOOP R&D
|
||
|
|
|||
Oct 15 2006, 10:15 PM
Post
#9
|
|||
![]() Extremely Active NI ![]() Posts: 607 Joined: 8-December 03 From: Dallas, Texas Member No.: 208 Using LabVIEW Since:2000 LV:8.6 ,8.2.1 ,7.1.1
My Gallery
|
Hey that sounds very interesting ! So you can create the correct connector pane constant ! I've been waiting for that for quite some time... Can you create such a constant given a non-typed VI ref ? I would find it hard to beilve that w/ all the scripting tools out there that it would be impossible... although I have not specifically tried yet. anyone.... Bueller?....Bueller?? -------------------- Norman J. Kirchner Jr.
Automation Software Engineer ~,~ The Captain Was Here Premium Blend ![]()
|
||
|
|
|||
Oct 23 2006, 07:46 PM
Post
#10
|
|||
|
More Active WIKI Moderator Posts: 47 Joined: 29-June 05 From: Santa Cruz, CA Member No.: 2496 Using LabVIEW Since:2000 LV:8.5 ,6.1 ,7.1.1
|
Bueller here.
http://xnodes.lavag.org/externalnodes/recursion.html I desire any and all feedback, this was a quick-as-possible venture that turned out to be quite nasty. Source code is open for all of those curious, especially since the source code directly touts my abilities as a scripter. Bonus features: - Manual construction of a constant by typedef number array (that stupid ref is *not* an object creatable by the Create Object function!) - Icon tweaking (a shadowed "R" -- which is fully customizable) - Manual internal reconstruction upon double click (if necessary, which I don't think it should be) Basically it's all that was talked about...just the code looks impossibly arbitrary because it took me a lot of trial and error to find out what LabVIEW would let me do. Now if only I could convert this VI directly into - Adam Rofer -------------------- Adam Rofer
|
||
|
|
|||
Oct 23 2006, 10:18 PM
Post
#11
|
|||
|
Instant Human, just add coffee Premium Member ![]() Posts: 889 Joined: 31-January 03 From: Waterford, CT USA Member No.: 45 Using LabVIEW Since:1992 LV:8.2.1 ,7.1 ,8.0.1
|
Nice idea. I think your example of factorial might take a second look. Maybe I did something simply wrong, but I built your example, exactly as shown and it returns an answer of 0. Makes sense, you keep subtracting one each time, til you get to zero, then pass out the eventual zero result and multiply. What am I missing here?
-------------------- ************************************************************* "Always listen to the experts, they'll tell you what can't be done, and why. Then go do it." ~The Notebooks of Lazarus Long (by Robert Heinlein) *************************************************************
|
||
|
|
|||
Oct 23 2006, 10:22 PM
Post
#12
|
|||
|
More Active WIKI Moderator Posts: 47 Joined: 29-June 05 From: Santa Cruz, CA Member No.: 2496 Using LabVIEW Since:2000 LV:8.5 ,6.1 ,7.1.1
|
One thing I've noticed is that frames sometimes don't refresh properly, so if you have a problem finding my previously referenced item (and you've been to my documentation site before) you can simply go here:
http://xnodes.lavag.org/externalnodes/recursion.html Nice idea. I think your example of factorial might take a second look. Maybe I did something simply wrong, but I built your example, exactly as shown and it returns an answer of 0. Makes sense, you keep subtracting one each time, til you get to zero, then pass out the eventual zero result and multiply. What am I missing here? I took the code directly from NI's example: http://zone.ni.com/devzone/cda/epd/p/id/1827 Check a few things, like if your VI is re-entrant. That needs to be the case or else my recursion thingy won't do anything but send back the default values for whatever outputs. - Adam Rofer This post has been edited by AdamRofer: Jan 2 2008, 11:01 PM -------------------- Adam Rofer
|
||
|
|
|||
Oct 23 2006, 10:35 PM
Post
#13
|
|
|
Instant Human, just add coffee Premium Member ![]() Posts: 889 Joined: 31-January 03 From: Waterford, CT USA Member No.: 45 Using LabVIEW Since:1992 LV:8.2.1 ,7.1 ,8.0.1
|
|