B.4 Import, export and memory management
The following statements are used to clear items from memory, save or load workspaces, and import or export items from/to text files.
Syntax | Arguments and performed function |
clear(A); | Clears item with id value A from memory. A could be any of the following data types:
or the keywords:
The statement clear(all); clears all items from memory, while, for example, clear(matrices); clears all matrices from memory. |
save(s); | Saves the current workspace (all items in memory) to the file specified by s.
|
load(s); | Loads a previously saved workspace from the file specified by s to the current workspace. The current workspace must be empty for the operation to proceed.
|
D = import(s , d ); D = webimport(s , d ); | D is a dataset constructed by reading the contents of the file or URL specified in s.
|
export(id, s , d); export(s1, s2 , <options>); | When used in the first format, export(id, s , d);, the function exports the item in memory with id value id to the file specified in s.
When used in the second format, the function exports the graph contained in the figure window with title s1 to the file specified in string s2. The type of the exported graph (eps, png or jpeg) is determined by the extension of the file provided in s2.
The <options> argument allows setting the width and height of the exported figure, in pixels. For example, export([...],"width"=100,"height"=100); will set the width and height of the exported figure to 100 pixels. The default values for "width" and "height" are 400 and 250, respectively. |