Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
tutorial:data [2017/07/21 15:04] – formatting oroehrig | user_guide:howto:data [2019/02/06 18:24] – [Handling polymake objects] added link to tarball tut oroehrig | ||
---|---|---|---|
Line 4: | Line 4: | ||
===== Handling polymake objects ===== | ===== Handling polymake objects ===== | ||
+ | Let us take this nice example object: | ||
+ | > $p = cube(3); | ||
To store polymake objects use the command | To store polymake objects use the command | ||
> save($p," | > save($p," | ||
+ | This silently overwrites existing files. | ||
+ | | ||
polymake objects that are stored in polymake' | polymake objects that are stored in polymake' | ||
> $p=load(" | > $p=load(" | ||
- | If you did not start '' | + | If you did not start '' |
$p=load(" | $p=load(" | ||
+ | TAB completion like in a usual UNIX shell supports you in navigating through the file system. | ||
+ | |||
+ | |||
**Note:** If you load a polymake object and compute new properties, these properties will automatically be added to the original XML-file at the end of the session. You can suppress this with the command | **Note:** If you load a polymake object and compute new properties, these properties will automatically be added to the original XML-file at the end of the session. You can suppress this with the command | ||
> $p-> | > $p-> | ||
- | called prior to leaving the session (but after the last compuation | + | called prior to leaving the session (but after the last computation |
+ | |||
+ | If you want to store a collection of objects into a single file, there is an [[.tarballs|extra tutorial]] for you. | ||
===== Handling complex data types ===== | ===== Handling complex data types ===== | ||
- | It is also possible to store complex | + | Apart from the full objects, you can also persistently |
> $s=new Set< | > $s=new Set< | ||
- | > save_data($s," | + | > save_data($s, |
+ | The description text is optional; it can be an arbitrary text, even stretching over several lines. | ||
To load such files just type | To load such files just type | ||
> $s=load_data(" | > $s=load_data(" | ||
+ | ===== Saving visualized objects ===== | ||
+ | Furthermore, | ||
+ | |||
+ | To save the cube visualized via JReality in a new file called '' | ||
+ | < | ||
+ | To save the cube as a TiKz file named '' | ||
+ | < | ||
===== Handling arbitrary files ===== | ===== Handling arbitrary files ===== | ||
Line 34: | Line 52: | ||
1 1 1 1 | 1 1 1 1 | ||
For the sake of the example, let's create this file: | For the sake of the example, let's create this file: | ||
- | > open($f, '> points.txt' | + | > open(my $f, '> points.txt' |
To read this file try the following: | To read this file try the following: | ||
> open(INPUT, "< points.txt" | > open(INPUT, "< points.txt" |