Company Events Academic Community Support Solutions Products & Services Contact NI MyNI

sprintf (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info
Download Help (Windows Only)

Owning Class: string

Requires: MathScript RT Module


str = sprintf(format, a)

str = sprintf(format, b, ...)


Formats the input data as a string. sprintf(format, a) applies a format until LabVIEW formats all the data in a or an error occurs. If a is a 2D matrix, LabVIEW formats a in column-wise order. sprintf(format, b, ...) formats the input data based on the corresponding format specifier. If you specify b, the number of specifiers in format must match the number of data elements in b.



Name Description
a Specifies the data you want to format as a string. a is a double-precision, floating-point number, a string, or a 1D or 2D matrix of those data types.
b Specifies the data you want to format as a string. b is a double-precision, floating-point number, or a string.
format Specifies the format you want to apply to a or b. format must use appropriate format specifier syntax. format is a string.


Name Description
str Returns a or b as a formatted string.


The following table lists the support characteristics of this function.

Supported in the LabVIEW Run-Time Engine Yes
Supported on RT targets Yes
Suitable for bounded execution times on RT Not characterized


STR = sprintf('This is %4.2d', 123.3455655)

STR = sprintf('%s is %4.2', 'This', 123.3455655)

Related Topics



Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
Add Comments 1 2 3 4 5 submit