cur2str

Bank-formatted text

Syntax

BankText = cur2str(Value,Digits)

Description

example

BankText = cur2str(Value,Digits) returns the given value in bank format.

The output format for BankText is a numerical format with dollar sign prefix, two decimal places, and negative numbers in parentheses; for example, ($123.45) and $6789.01. The standard MATLAB® bank format uses two decimal places, no dollar sign, and a minus sign for negative numbers; for example, −123.45 and 6789.01.

Examples

collapse all

Return bank formatted text for a negative numeric value.

BankText = cur2str(-826444.4456,3)   
BankText = 
'($826444.446)'
% Negative numbers are displayed in parentheses.

Input Arguments

collapse all

Value to be formatted, specified as a numeric value.

Data Types: double

Number of significant digits, specified as an integer. A negative Digits rounds the value to the left of the decimal point.

Data Types: double

Output Arguments

collapse all

Bank-formatted text (BankText) is returned as a character vector with a leading dollar sign ($). Negative numbers are displayed in parentheses.

See Also

|

Introduced before R2006a