format
format de conversion


format
htm
name
See also

format

format("<descript> expr")

        Converts expr according to the description. descript consists of a list of characters separated by commas:
        * format ignored.
        numeric: forced value.
        X: converted values.
Examples: format("<*,X> comment 123"); returns 123.

x=" \n";
y=format("<*,X,X,0.0> coordinates 1.0 2.0\n coordinates 11.0 22.0");
returns vector:
(1,2,0.0,11.0,22.0,0.0);
Allows, for example, by forcing z 0, to read a file foo in the form:
xyz 1.0 2.0 3.0
xyz 11.0 22.0 33.0

y=format("<*,X,X,0.0>",read(\"foo\")";

format("b",x);

        Converts integer x>0 in binary.

format("f",x);

        Converts binary x (list of 0 and 1) in integer.
Note:
Binary is expressed in 32 bits starting with the low weights.

Examples:

format("b",123); returns: (1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,)
format("f",(1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)); returns 7

Use:

To convert ASCII data files into variables (anyflo format).

Example:

Given file foo containing:
1: 1.1 2.2
2: -1.1 10.7 3: 10.1 -12.4
x=format("<*,X,X,0.0>",read("toto")); returns vector x containing: (1.1,2.2,0.0,-1.1,10.7,0.0,10.1,-12.4,0.0)

format("m",x,y,x1,x2,y1,y2,m)

        Returns the sum of the matrix elements of m (x columns, ylines) located between the x1 and x2 columns and lines y1 and y2.

format("c",x,y,x1,x2,y1,y2,m)

        Returns the center of gravity of the matrix elements of m (x columns, ylines) located between the x1 and x2 columns and lines y1 and y2.

format("c",x,y,x1,x2,y1,y2,m,c)

        Returns the center of gravity of the matrix elements of m (x columns, ylines) located between the x1 and x2 columns and lines y1 and y2 and whose value is greater than c (white on black).

format("c",x,y,x1,x2,y1,y2,m,c,"<")

        Returns the center of gravity of the matrix elements of m (x columns, ylines) located between the x1 and x2 columns and lines y1 and y2 and whose value is lesser than c (black on white).
Note:
Must:
x1 >= 0 x1 < x
x2 >= 0 x2 < x
x1 <= x2
y1 >= 0 y1 < y
y2 >= 0 y2 < y
y1 <= y2
Example:
m=[1,12];
format("m",4,3,0,2,1,2,m;
returns 48=5+6+7+9+10+11

format("<htm>")

        Returns the list of special characters and their HTML.

format("<htm>c")

        Returns the html code of the character c.

format("<htm>&codehtml;")

        Returns the character whose code is ;&codehtml;
Examples
format("<htm>à");
        Returns &agrave;
format("<htm>&agrave;");
        Returns à
Notes:
1) The correspondence between the html codes and the ASCII codes are stored in file
code_htm.
2) It is possible to modify this file.
3) If the file htm does not exist the codes are initialized by default.

format name

format name("nnn.eee")

Returns eee.
See also name name.

See also:

edit format
write format
inv format
read format
product format
sort format