Malleable VIs

LabVIEW 2017 Help

Edition Date: March 2017

Part Number: 371361P-01

»View Product Info
Download Help (Windows Only)

A malleable VI (.vim) is a VI that is inlined into its calling VI and can adapt each terminal to its corresponding input data type. With malleable VIs, you build a VI to perform the same operation on any acceptable data type instead of saving a separate copy of the VI for each data type. The malleable VIs that LabVIEW provides have orange backgrounds.

Polymorphism of Malleable VIs

All terminals of malleable VIs are polymorphic. Each time you wire an input data type to a terminal, type propagation runs to check if the wired type is acceptable. If type propagation errors are not detected, the malleable VI adapts the terminal to the input data type. For example, the Sort 2D Array VI is a malleable VI. The 2D array input accepts an array of any data type except refnums. The index input accepts a signed 32-bit integer or an array of signed 32-bit integers.

Malleable VIs differ from polymorphic VIs in the following ways:

  • A polymorphic VI uses a predefined set of acceptable data types. A malleable VI computes whether a data type is acceptable by implementation. A malleable VI is more flexible when determining which data types are acceptable.
  • A malleable VI is one single VI. A polymorphic VI is a collection of instance VIs.
  • You convert any standard VI into a malleable VI by changing the file extension to .vim. For polymorphic VIs, you must create an instance VI for each data type and combine the instance VIs into one polymorphic VI.
  • A malleable VI has the same set of terminals for any data type. A polymorphic VI consists of a collection of instance VIs that can have different sets of terminals for different data types. A malleable VI performs the same operation with the same implementation on any acceptable data type. A polymorphic VI can be configured to perform the same operation with different implementations across data types.
  • A malleable VI adapts to any acceptable input data type. A polymorphic VI has the flexibility of predefining the acceptable data types.

Use malleable VIs when you perform the same operation on any acceptable data type and the operation can be implemented in the same way for different data types. To perform the same operation on a predefined set of data types or if the operation must be implemented differently across data types, use polymorphic VIs instead.

Refer to the labview\examples\Malleable VIs\Basics\Malleable VIs Basics.lvproj for an example of using malleable VIs.

Related Information

Building Malleable VIs

WAS THIS ARTICLE HELPFUL?

Not Helpful