Building Malleable VIs

LabVIEW 2017 Help

Edition Date: March 2017

Part Number: 371361P-01

»View Product Info
Download Help (Windows Only)

Build malleable VIs to perform the same operation on any acceptable data type instead of saving a separate copy of the VI for each data type. Malleable VIs are useful if an operation can be implemented in the same way for different data types. If the operation must be implemented differently across data types or if you want to predefine the acceptable data types, build a polymorphic VI instead.

You can create a malleable VI in the following ways:

  • To create a new, blank malleable VI, select File»New and select Malleable VI from the New dialog box.
  • To convert an existing VI into a malleable VI, set the file extension to .vim. If the existing VI is not configured to be inlined into its calling VIs, the malleable VI appears broken. You must configure the malleable VI to be inlined by selecting File»VI Properties»Execution, enabling the Inline subVI into calling VIs and Preallocated clone reentrant execution options, and disabling the Allow debugging and Enable automatic error handling options.
    Note Note  You can convert only standard VIs into malleable VIs. You cannot convert polymorphic VIs, global VIs, or XControl abilities into malleable VIs.

When you place a malleable VI on the block diagram, the inputs and outputs display the default data types. If you wire a control, indicator, or constant to an input or output, the input or output adapts to the wired data type.

For example, in the Sort 2D Array malleable VI, the 2D array input and the sorted 2D array output accept 2D arrays of any data type except refnums, with 2D array of variant as the default data type. If you wire a 2D array of string to 2D array, the data types of 2D array and sorted 2D array both change to 2D array of string. However, if you wire a 1D array to 2D array, the VI appears broken because this malleable VI is not implemented to accept 1D arrays.

You cannot predefine the acceptable input data types for malleable VIs. For example, to allow 2D array to accept 2D arrays of integers and strings only, you must build a polymorphic VI by converting the Sort 2D Array malleable VI into a standard VI, creating an instance VI for each predefined data type based on the standard VI, and combining the instance VIs into one polymorphic VI.


Not Helpful