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

sscanf (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

Syntax

[a, count, error, next] = sscanf(str, format)

[a, count, error, next] = sscanf(str, format, size)

Description

Reads data from an input string using the given format.

Details

Examples

Inputs

Name Description
str Specifies the input string to read. str is a string or 1D matrix of strings.
format Specifies the format in which to read the data in str. format must use appropriate format specifier syntax. format is a string.
size Specifies the amount of data to read from str. If str is a string, size must be a scalar. If str is a matrix of strings, size must be an array. LabVIEW discards all but the first two elements of size. If size is less than 0, LabVIEW reads str using the specified format until it reads all the data or an error occurs. size is a 32-bit signed integer or a 1D matrix of those values.

Outputs

Name Description
a Returns the formatted data from the input string. a is a vector or 2D matrix of double-precision, floating-point numbers.
count Returns the amount of data that LabVIEW read successfully from str. count is a 32-bit signed integer.
error Returns an error message. error is a string.
next Returns the index of the first character past the end of str, or the number of characters that LabVIEW read successfully from str. If an error occurs, next returns the index of the first character at which the error occurs. next is a 32-bit signed integer.

Details

If the first and second elements in size are m and n, this function reads data into an m-by-n matrix in column-wise order. m must be greater than zero. Otherwise, this function returns an empty matrix. If n is less than 0, LabVIEW reads str using the specified format until it reads all the data or an error occurs.

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

Examples

[A, count, error, next] = sscanf('1.2 3.4 5.6', '%f', 2)

[A, count, error, next] = sscanf(strvconcat('1 2 3 4', '4 5 6 7'), '%d', [2, 2])

Related Topics

sprintf
strread


 

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