LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The thing that really bothers me -> disabling part of the code.

Hi there.

Maybe this is already included in LabView but I can't find it -> anyway what would I really like to have is to select part of the code(block diagram) and disable it so it wont be executed -> like you would comment out the code in C.

This is really getting on me.

So NI guys if this feature is not included yet, could you add it. PLLEEEEEEEESSEE. 🙂

Peace
Waldemar
0 Kudos
Message 1 of 11
(4,189 Views)
Hi Waldemar

I also complained about that, but there just the possibility to use a case-structure.

So put the case-structure around your code and wire a constant to it, so that it will not be executed.

Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 11
(4,178 Views)
Have you tried dropping a case structure around the code you want to disable with a constant [T/F] wired to the case selector terminal?

Logically, it's very difficult to disable random chunks of code when there are data dependencies.
0 Kudos
Message 3 of 11
(4,177 Views)
This does actually exist in LV - the PDA module (and probably FPGA) has a structure called Conditional Disable Structure which is like a case structure for different platforms. Code placed not in your platform can be broken and the VI will still run - the code will simply be ignored. I hope that NI will implement this as standard in 8.0.

___________________
Try to take over the world!
0 Kudos
Message 4 of 11
(4,168 Views)
The case doesn't do it -> then when you want to disable it -> you have to copy/paste the "code" and if there are some references to graphs(or something) in there LV will create another instance. Now all the cables need to be rerouted,....

Ok I understand if there are some references that go from the disabled code -> LV could just complain that it can't do that, but what's with the code that doesn't have any output references -> the code can simply be "just disabled" and that is it.


Well I hope to that they will do something about this.

Peace
Waldemar
0 Kudos
Message 5 of 11
(4,159 Views)
You can actually remove case structures now (I don't know which version this is new in, but certainly someone will) without destroying or copying out the code inside. Just right-click and choose "Remove Case Structure" and it keeps whatever was showing (along with wires in). Its very useful.
0 Kudos
Message 6 of 11
(4,157 Views)
Hi Waldemar,
I'm not sure what you mean by: "The case doesn't do it -> then when you want to disable it -> you have to copy/paste the "code" and if there are some references to graphs(or something) in there LV will create another instance. Now all the cables need to be rerouted,...." ?

As mentioned before, when you want to comment out a section of code just put a case around it wired to the appropriate T/F constant. Yes you will have to go to the other case and wire the "inputs" to the case to the "outputs". When you are done debugging, you can either just change the constant (the case doesn't add very much overhead in the code) or delete it by selecting the case with the code you want showing and then right clicking on the case structure and selecting "Remove Case Structure". It will give you a warning that code in the other cases will be removed. If the problem is that there are elements that will be "cased out" that you would want to remain, to possibly display data without the cased out function/calc, etc. then you probably need to break up the "cased out" code into more than one case. Not exactly elegant, but I'm not sure how you would do it otherwise in a graphical language.

P.M.
Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 7 of 11
(4,136 Views)
Not to worry - you're not the only person to think that this is a needed feature. Stay tuned for the next LabVIEW upgrade...
0 Kudos
Message 8 of 11
(4,118 Views)
Putting a case structure around things is a terribly insufficient way to have to try and disable code. Not only that, but it doesn't actually comment out the code, it just makes it not execute, which means that LabVIEW still tries to compile it.

As tst stated earlier however, this feature is available, it's just not ready for prime time yet so it hasn't been formally released as part of the LabVIEW package. It doesn't completely work as expected sometimes, which is discussed in detail on the Lava forums here:

http://forums.lavausergroup.org/index.php?showtopic=356&hl=


The attached VI is more or less the same VI posted on the LAVA forums. Here is how to make it work effectively while you're coding.

- Download the VI, either the one I've attached or the one in the post above which you would need to modify yourself.

- Place the VI in the LabVIEW 7.1\user.lib directory.

- Restart LabVIEW

- From the menu... > Tools > Advanced > Edit Palette Views

- Navigate to the User Libraries palette where the VI will be displayed.

- Right click the VI and select "Merge VI".

Now whenever you drag the VI onto the block diagram you will have a disable structure to place non-compileable code in. Just be careful and read the entire list of caveats that come with it (reference the Lava post) ... where it gets hairy is placing non-compileable subvi's in the disable structure, which will break your VI without giving you a clue as to why it's broken 🙂
0 Kudos
Message 9 of 11
(4,113 Views)
Two things can help this issue greatly. First, pay attention to how you write your code. I have found that if I modularize my application properly the instances where I have to go to extra trouble to disable things drops to almost nill. Second, pay attention to how you manage errors. At times I have disabled code by simply wiring an error cluster containing an error to the beginning of the call chain for that chunk of code.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 10 of 11
(4,085 Views)