Function: s = intervaltotext (X)
Function: s = intervaltotext (X, cs)

Convert interval X to an interval literal string s, which contains X.

Output s is a simple string for scalar intervals, and a cell array of strings for interval arrays.

The interval boundaries of X are stored in binary floating point format and are converted to decimal or hexadecimal format with possible precision loss. If output is not exact, the boundaries are rounded accordingly (e. g. the upper boundary is rounded towards infinite for output representation).

The desired layout of interval literal s can be customized with conversion specifier cs as follows.

overall_width : [ flags width . precision conversion ]

The output shall be an interval literal in inf-sup form (default). Its format may be customized by the following options:

  • The preferred overall_width for the interval string s. If specified, it must be followed by a colon. Use this option to vertically align a list of intervals.
  • To output the bounds of interval X without punctuation, omit the square brackets in the conversion specifier. For instance, this might be a convenient way to write intervals to a file for use by another application.
  • The number format specification for the interval boundaries may be prefixed by the following flags to modify the default format:
    C

    Use upper case for Entire, Empty, and NaI

    c

    Use lower case for Entire, Empty, and NaI

    <

    Output Entire as [-Inf, +Inf] instead of [Entire]

    -

    Left justify within the given field width

    +

    Always use a plus sign for positive numbers. By default the plus sign is only used for intervals with an inner zero.

     

    Never use a plus sign for positive numbers

    0

    Left-pads the numbers with zeros instead of spaces within the field width

  • The preferred field width for upper and lower boundaries.
  • The precision for upper and lower boundaries, that is the number of digits after the point. If specified, it must be preceded by a point.
  • The number format conversion defines the radix and notation of lower and upper boundaries. This is the only mandatory component of the conversion specifier. The following values are supported: f / F (for decimal floating-point), e / E (scientific notation), g / G (use either decimal floating-point or scientific notation, depending on what is more appropriate for the magnitude of the number), a / A (hexadecimal floating-point).
overall_width : flags width . precision ? radius_width conversion

The output shall be an interval literal in uncertain form. Its format may be customized by the following options:

  • The preferred overall_width for the interval string s. If specified, it must be followed by a colon. Use this option to vertically align a list of intervals.
  • The number format specification for the interval midpoint may be prefixed by the following flags to modify the default format:
    d

    Use one-sided form with upper boundary and uncertain ulp-count in downward direction. By default the symmetric form with midpoint and radius is used. For unbound intervals, this flag is ignored and the direction is chosen automatically.

    u

    Use one-sided form with lower boundary and uncertain ulp-count in upward direction. For unbound intervals, this flag is ignored.

    C

    Use upper case for Entire, Empty, and NaI

    c

    Use lower case for Entire, Empty, and NaI

    +

    Always use a plus sign for positive numbers

    0

    Left-pads the interval midpoint with zeros instead of spaces within the field width

  • The preferred field width for the interval midpoint.
  • The precision for the interval midpoint, that is the number of digits after the point. If specified, it must be preceded by a point.
  • The radius_width specifies the desired number of digits for the non-negative integer ulp-count. The ulp-count will be padded with zeros, because whitespace is not permitted within the uncertain form.
  • The number format conversion defines whether an exponent field is absent or present. The following values are supported: f / F (for decimal floating-point), e / E (scientific notation), g / G (use either decimal floating-point or scientific notation, depending on what is more appropriate for the magnitude of the number).

See also: @infsup/printf, @infsup/fprintf, @infsup/sprintf.

Package: interval