Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: Français - Português - Русский - 日本語
Scilab Help >> Elementary Functions > Floating point > format

format

number printing and display format

Syntax

format([type],[long])
v = format()
format(m)

Arguments

type

character string

long

integer (max number of digits (default 10))

v

a vector for the current format.

v(1) is a type of format : 0 for 'e' and 1 for 'v'

v(2) is a number of digits

m

a vector to set new format

m(1) is a number of digits

m(2) is a type of format : 0 for 'e' and 1 for 'v'

Description

Sets the current printing format with the parameter type; it is one of the following :

"v"

for a variable format (default)

"e"

for the e-format.

long defines the max number of digits (default 10). format() returns a vector for the current format: first component is the type of format (1 if 'v' ; 0 if 'e'); second component is the number of digits.

In the old Scilab versions, in "variable format" mode, vector entries which are less than %eps times the maximum absolute value of the entries were displayed as "0". It is no more the case, the clean function can be used to set negligible entries to zeros.

Examples

x=rand(1,5);
format('v',10);x
format(20);x
format('e',10);x
format(20);x

x=[100 %eps];
format('e',10);x
format('v',10);x

format("v")

See Also

  • write — write in a formatted file
  • disp — displays variables
  • print — prints variables in a file
  • clean — cleans matrices (round to zero small entries)

Comments

Author : Michael Pratt posted the 10/04/2015 18:18
It would be appreciated if the value for the number of digits was forced rather than just a maximum, or even possibly having the two different options, so that integers can be displayed with trailing zeros like (4.000) if desired.
Reply to this comment
Please login to comment this page


Add a comment:
Please login to comment this page.

Report an issue
<< floor Floating point frexp >>

Scilab Enterprises
Copyright (c) 2011-2015 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Jun 15 08:27:33 CEST 2016