10-18-2021 04:51 PM
Hi, I'm trying to create a VI with a selection of my data in the same way that the option "Create a subVI" do it. The problem is that I don't want to create a clone.
Can you tell me how can I create a VI from my selected data? or maybe how can I create a subVI without "clone" legend.
10-19-2021 08:17 AM
You can create a VI (whether a sub-VI, designed to be called by other VIs, possibly passing in data using Controls on the Front Panel and passing out data using Front Panel Indicators, or a Main, Top-Level VI, where the Controls are designed to be "manipulated" by the User, and the Indicators are for the User to "visualize the Data") by opening LabVIEW and typing Ctrl-N, for "New VI". This will generate a "blank" VI, with a generic name and a generic Icon, both of which you can (and should) change, populating the Front Panel and Block Diagram as you see fit (to do whatever you want the sub-VI to do).
The other way to do this is to "carve out" some existing code from a VI by selecting the code on the Block Diagram and choosing "Create sub-VI" from the Edit menu. LabVIEW will use some "behind-the-scenes" algorithms to put the code in a new VI with a generic name ("Untitled 1 (SubVI)") and a generic Icon, and will generally create Inputs and Outputs using the 4-2-2-4 Conector Pane, with Error In and Error Out (if you included the Error Line in your selection) in the lower corners.
When I first started learning LabVIEW, I used "Create sub-VI" to get me going. Now, I never use it, but rather create my sub-VIs "from Scratch", with each having a simple (often Text) Icon, a 4-2-2-4 (the default) Connector pattern, Error In and Error Out, and whatever Inputs and Outputs I want. [I discussed a few months ago on the Forum creating a VI Template and using the "File, New ..." command to automatically start my New VI with a blank Icon and Error In/Out pre-placed and pre-connected]. This lets me design the wiring and organization of the sub-VI in a way that makes sense to me.
Bob Schor
10-19-2021 11:37 AM
@Bob_Schor wrote:
You can create a VI (whether a sub-VI, designed to be called by other VIs, possibly passing in data using Controls on the Front Panel and passing out data using Front Panel Indicators, or a Main, Top-Level VI, where the Controls are designed to be "manipulated" by the User, and the Indicators are for the User to "visualize the Data") by opening LabVIEW and typing Ctrl-N, for "New VI". This will generate a "blank" VI, with a generic name and a generic Icon, both of which you can (and should) change, populating the Front Panel and Block Diagram as you see fit (to do whatever you want the sub-VI to do).
The other way to do this is to "carve out" some existing code from a VI by selecting the code on the Block Diagram and choosing "Create sub-VI" from the Edit menu. LabVIEW will use some "behind-the-scenes" algorithms to put the code in a new VI with a generic name ("Untitled 1 (SubVI)") and a generic Icon, and will generally create Inputs and Outputs using the 4-2-2-4 Conector Pane, with Error In and Error Out (if you included the Error Line in your selection) in the lower corners.
When I first started learning LabVIEW, I used "Create sub-VI" to get me going. Now, I never use it, but rather create my sub-VIs "from Scratch", with each having a simple (often Text) Icon, a 4-2-2-4 (the default) Connector pattern, Error In and Error Out, and whatever Inputs and Outputs I want. [I discussed a few months ago on the Forum creating a VI Template and using the "File, New ..." command to automatically start my New VI with a blank Icon and Error In/Out pre-placed and pre-connected]. This lets me design the wiring and organization of the sub-VI in a way that makes sense to me.
Bob Schor
I occasionally use "Create SubVI" on my own code (I use it quite often in other dev's code) when I realize this "simple" VI is actually doing more than I intended.