LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Disable parts of a VI

Hello,
is it possible to disable parts of a VI (like /* .....*/ or //..... in C)
I do not want to CUT and PASTE in a new VI, and afterwards CUT and PASTE
back.

Thanks, CHZ
0 Kudos
Message 1 of 4
(2,892 Views)
CHZ wrote in message <38d78b86@newsgroups.ni.com>...
>Hello,
>is it possible to disable parts of a VI (like /* .....*/ or //..... in C)
>I do not want to CUT and PASTE in a new VI, and afterwards CUT and PASTE
>back.
>
>Thanks, CHZ


Use a case structure and tie that to a boolean constant, you can turn it on
or of manually.
In the other case you can easily create constants to replace the outcome of
the code (if there is any) you would like to disable.
Later when you do want to use it again, select the case you would like to
use and choose "Remove case structure". You'll get a warning that the code
in the other case is wasted but those were constants anyway (or empty).

RB.
0 Kudos
Message 2 of 4
(2,892 Views)
> Use a case structure and tie that to a boolean constant, you can turn it
on
> or of manually.

Thank you for your answer!

But you still have the problem of unwired In/Outputs. To make the VI run,
all In/Outputs have to be connected. Do You know anything about that
problem?

Second: Do you know the #IFDEF / #ENDIFDEF function of C++?
You set one variable FALSE at the beginning, and many belonging together
parts of the program are disabled.
I'm looking for a solution like this.
Do you know anything?

Thanks, CHZ
0 Kudos
Message 3 of 4
(2,892 Views)
CHZ wrote in message <38d871f6@newsgroups.ni.com>...
>> Use a case structure and tie that to a boolean constant, you can turn it
>on
>> or of manually.
>
>Thank you for your answer!
>
>But you still have the problem of unwired In/Outputs. To make the VI run,
>all In/Outputs have to be connected. Do You know anything about that
>problem?


As I wrote in the previous message: select a case structure in the
'Functions'-panel. Drag it over the code you would like to disable. One case
(usually the "false" case) will be filled with the code you selected and
automatically in and outports to the case will be created. Now switch over
to the other case ("true"). Right-click the "empty" output ports and select
'Create constant'. Inputs into the case do not need
to be wired to
something. Depending on the function of your code you could also wire the
inputs to the outputs (in the case where youre code modifies the data but
not changes it's type).

>Second: Do you know the #IFDEF / #ENDIFDEF function of C++?
>You set one variable FALSE at the beginning, and many belonging together
>parts of the program are disabled.
>I'm looking for a solution like this.
>Do you know anything?
>
>Thanks, CHZ

There are no pre-compiler statements in LabVIEW. Ofcourse there is always a
way.....: You could work again with the case structures to disable your code
but in this case wire the case to a global variable. If you use this same
global variable troughout all your VI's and you make sure you set this
variable at the beginning of your program (top VI) then code will be
disabled or enabled in all the VI's and subVI's that will make up your
program.

RB.
0 Kudos
Message 4 of 4
(2,892 Views)