07-10-2017 04:02 AM
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.
Solved! Go to Solution.
07-10-2017 04:39 AM - edited 07-10-2017 04:39 AM
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…
07-10-2017 04:40 AM
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.
07-10-2017 04:41 AM
@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.
07-10-2017 04:43 AM
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.