Search code examples
introspectionlabview

Can a LabVIEW VI tell whether one of its output terminals is wired?


In LabVIEW, is it possible to tell from within a VI whether an output terminal is wired in the calling VI? Obviously, this would depend on the calling VI, but perhaps there is some way to find the answer for the current invocation of a VI.

In C terms, this would be like defining a function that takes arguments which are pointers to where to store output parameters, but will accept NULL if the caller is not interested in that parameter.


Solution

  • As it was said you can't do this in the natural way, but there's a workaround using data value references (requires LV 2009). It is the same idea of giving a NULL pointer to an output argument. The result is given in input as a data value reference (which is the pointer), and checked for Not a Reference by the SubVI. If it is null, do nothing.

    Here is the SubVI (case true does nothing of course):

    alt text

    And here is the calling VI:

    alt text

    Images are VI snippets so you can drag and drop on a diagram to get the code.