socket_read_ascii_float(number, socket_name=’socket_0’, timeout=2)

Reads a number of ascii formatted floats from the socket. A maximum of 30 values can be read in one command.

The format of the numbers should be in parantheses, and seperated by ",". An example list of four numbers could look like "( 1.414 , 3.14159, 1.616, 0.0 )".

The returned list contains the total numbers read, and then each number in succession. For example a read_ascii_float on the example above would return [4, 1.414, 3.14159, 1.616, 0.0].

A failed read or timeout will return the list with 0 as first element and then "Not a number (nan)" in the following elements (ex. [0, nan, nan, nan] for a read of three numbers).

Parameters

number: The number of variables to read (int)

socket_name: Name of socket (string)

timeout: The number of seconds until the read action times out (float). A timeout of 0 or negative number indicates that the function should not return until a read is completed.

Return Value

A list of numbers read (length=number+1, list of floats)

  • Example command: list_of_four_floats = socket_read_ascii_float(4,"socket_10")
    • Example Parameters:
    • number = 4 → Number of floats to read
    • socket_name = socket_10
    • returns list