Using NAG Library routines in LabVIEW

How to call NAG routines from LabVIEW

Routines and methods from the NAG Library can be accessed from within the LabVIEW programming environment.  Some detailed (but general) information about how to use external routines - such as those provided by the NAG Library - in LabVIEW can be found here [pdf].

Recent work that describes how to call routines from the NAG Fortran Library or the NAG C Library from inside a simple LabVIEW application is presented here.  An alternative approach is to invoke methods provided by the NAG Library for .NET; an account of how to do that in LabVIEW is here, whilst an example showing the use of all three libraries to extend LabVIEW in a 64-bit environment is described here.  This presentation provides a self-contained account of these approaches (incorporating a couple of specific example applications which use NAG routines), together with a description of how to construct a wrapper library around selected NAG functions, and then import that into LabVIEW.   

Finally, a user's experiences of calling NAG Fortran Library routines from within LabVIEW are available in this presentation, which has been kindly provided by John Keightley of NPL, Centre for Ionising Radiation Metrology.


This archive contains nineteen LabVIEW examples which use a variety of NAG routines and methods, including the:

  • minimization of a smooth function subject to constraints (including bounds on the variables, linear constraints and smooth nonlinear constraints) using a sequential programming method.
  • calculation of the mean, standard deviation, coefficients of skewness and kurtosis, and the maximum and minimum values for a set of ungrouped data.
  • solution of a general quadratic programming problem.
  • computation of the LU factorization of a real matrix.
  • calculation of the rank and pseudo-inverse of a real matrix.

The examples have been built under Windows 7 using LabVIEW Version 11.0 (both 32 bit and 64 bit) and, before running any of them, the user must have the appropriate version of LabVIEW, together with the relevant NAG Library installed on their machine. More information on software prerequisites is to be found in this README (a copy of which is also contained in the archive). Update (June 11 2012): the archive has been updated to include a 64 bit example, and new versions of the NAG C Library examples that now use the latest version (Mark 23) of that Library.

Although this collection of examples has been built and run on the platform mentioned above, it is not a NAG product. However, we are keen to receive user feedback, and will respond to technical queries and problem reports via with the aim of further refining this collection and making it still more useful to the LabVIEW community.