05-30-2016 09:46 AM
Hello,
I was wondering if there is an option to only run a certain part of the code that is inside a block and disable everyting outside of the box. Sort of the opposite of the 'diagram disable'. I know I could put all the code except for what I want to test in a diagram disable, but it seems a bit devious.
Thank you
05-30-2016 09:56 AM
05-30-2016 12:31 PM
copy/paste it into a new VI
05-30-2016 12:35 PM
So here's what I do in that situation (indeed, my "usual approach" to using Diagram Disable (which I really appreciate when I need it). Let's say that there's a moderately-sized piece of code that I want to "simplify" by removing isolated pieces, maybe "around the edges" as you seem to suggest. I do the following (taking advantage of the "Case-like" structure of Diagram Disable:
This is the LabVIEW equivalent of "Having your Cake and Modifying/Testing It, Too".
Bob Schor
05-30-2016 05:12 PM
@Allard171 wrote:
I was wondering if there is an option to only run a certain part of the code that is inside a block and disable everyting outside of the box. Sort of the opposite of the 'diagram disable'. I know I could put all the code except for what I want to test in a diagram disable, but it seems a bit devious.
The problem is with dataflow, because if you disable the wires going into your section, their values are not really defined. One possible workaround would be that it could be implemented if we enable the debugging tool "retain wire values". Now all wires going into the interesting section have defined values even if their upstream souce might be disabled. Unfortunately, you cannot easily change these values. You also still have serious problems if far parts of the code intereact (e.g. via local variables, queueus, etc.), so this still seem dangerous in general.
Have a look at this idea and its discussions. I think you are looking for something similar.
Of course in a well designed, modular LabVIEW program, there should be plenty of subVIs, and each is individually runnable and debuggable. Run the main program once with the interesting subVI front panel open and the subVI will now have typical values on all the controls that will remain unitl you close the project and you can run the subVI standalone with the last-seen data, but you can of course change the controls values at will to see what happens.
05-31-2016 01:45 AM
@natasftw wrote:copy/paste it into a new VI
Or, more quickly, select the relevant code and select Edit>>Create SubVI from the menus. You can then undo to go back. Of course, as already pointed out, it's likely you should have more subVIs, so maybe you should save the subVI rather than undo.
05-31-2016 03:35 AM
@tst wrote:
@natasftw wrote:copy/paste it into a new VI
Or, more quickly, select the relevant code and select Edit>>Create SubVI from the menus. You can then undo to go back. Of course, as already pointed out, it's likely you should have more subVIs, so maybe you should save the subVI rather than undo.
I was about to say something to this effect. Sub VI's are good, OPs predicament is a perfect explanation as to why you should create them. Create them. Sub VI's good. 😉
/Y