Skip to content

rats

builtin · libnexusinterp/corefcn/pr-output-proprietary.cc

: s = rats (x)
: s = rats (x, len)

Return a character array of rational approximations to the elements of x.

x must be single or double. len is the field budget for each element and defaults to 13. Real input is len+1 characters wide per element; complex input is 2*len+3. A leading blank separates elements. The numerator is printed in a field of width floor((len-1)/2) and the denominator in ceil((len-1)/2). Values that do not fit, and are not negligible at the tolerance min(10^(-(len-1)/2)*norm(X(isfinite(X)),1), 0.1), are replaced by ‘*’.

With more than two dimensions, trailing dimensions are folded into the columns. Empty input, including an empty cell, is a 0-by-0 character array.