Contents Previous Next Subchapters

Converting A Number To ASCII Characters
Syntax ntoa(numbers)
See Also atod , atoi , char , format

Returns a character-matrix representation of the specified numbers, where numbers is an integer, real, double-precision, or complex column vector. The i-th element of numbers is represented by the i-th row of the return value. The current format for the type of numbers is used to convert the values. For example, if numbers is real, and the current format of real values specifies that they be displayed within 10 columns, ntoa will return a character matrix with 10 columns.

This function is useful when you want to display a number as text in a graphics plot or when you want to use different formats for outputting different columns of a matrix.

     format real "f10.5"
     x = ntoa({4., 3., pi})
     format real "f5.1"
     y = ntoa({4., 3., pi})
     print [x, y]
        4.00000  4.0
        3.00000  3.0
        3.14159  3.1
You can restore real formatting to its original value with the command
     format real ""