LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI as virtual code organization and no need to save on disk ?

Solved!
Go to solution

When I use mathworks simulink, I have the option to create "virtual subsystem" which basically just shrink a block of code. It does not save a file on disk. I also have the option to create "nonvirtual subsystem" which saves in a library file on disk.

In labview, I'd like to organize block digram and reduce clutter so I put code in subVIs. These subVIs have only to do with the immediate VI that they sit on. So they count as code organization and maybe not code reuse. The problem is if I keep doing this, every main VIs I create have its own dozen subVIs that are not useful elsewhere. It is really a mess.

If labview allows create and embed a virtual local subvi, my problem would be solved.

0 Kudos
Message 1 of 5
(2,283 Views)

Hi zigbee,

 

The problem is if I keep doing this, every main VIs I create have its own dozen subVIs that are not useful elsewhere.

In LabVIEW a VI is a file of its own. You may use this VI as MainVI or subVI, it still is a file of its own.

Conclusion: "one VI, one file".

 

It is really a mess.

That depends how you organize those VIs on disc. You may use subfolders, you may use filenaming conventions…

 

More ideas:

- The old (and not recommended anymore) LLBs allow to store several VIs in just one file. (There are limitations.)

- You might think about PPLs…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(2,261 Views)

LabVIEW doesn't - SubVIs need to be saved on disk as separate files. You could consider building a Packed Project Library if you're deploying the code somewhere and multiple files bother you, but really this is just a limitation of the LabVIEW infrastructure.

 

However, is there really a problem with having lots of files? You could put them in a subdirectory to avoid cluttering a shared location if needed.


GCentral
0 Kudos
Message 3 of 5
(2,257 Views)

@zigbee1 wrote:
[...]

If labview allows create and embed a virtual local subvi, my problem would be solved.


Why do you have problems with multiple files in the first place?

Besides, Matlab is no programming language. LV is a programming language. Comparing the two is neither fair (to each of them) nor useful.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 5
(2,255 Views)
Solution
Accepted by topic author zigbee1

You might want to give this idea a look: http://forums.ni.com/t5/LabVIEW-Idea-Exchange/quot-Pseudo-VI-quot-The-end-of-single-use-sub-VIs/idi-...

 

My opinion is that reuse kicks in a lot more than you would think.  If you are not seeing that, you might be modularizing your code ineffectively.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 5
(2,250 Views)