Table Of Contents

sscanf

Version:
    Last Modified: March 15, 2017

    Reads data from an input string using the given format.

    Syntax

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

    Inputs

    str

    Input string to read. str is a string or a matrix of characters.

    format

    Format in which to read the data in str. format must use appropriate format specifier syntax. format is a string.

    size

    Amount of data to read from str. MathScript discards all but the first two elements of size. If size is less than 0, MathScript reads str using the specified format until it reads all the data or an error occurs. size is an integer or an array of those values.

    Outputs

    a

    Formatted data from the input string. a is a vector or 2D matrix of double-precision floating-point numbers, a string, or a matrix of characters.

    count

    Amount of data that MathScript reads successfully from str. count is a double-precision floating-point number.

    error

    Error message. error is a string.

    next

    Index of the first character past the end of str, or the number of characters that MathScript reads successfully from str.If an error occurs, next returns the index of the first character at which the error occurs.

    Elements of Size

    If the first and second element 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, MathScript reads str using the specified format until it reads all the data or an error occurs.

    [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])

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: This product does not support FPGA devices


    Recently Viewed Topics