ARCHIVED: Save variables in Maple

This content has been archived, and is no longer maintained by Indiana University. Information here may no longer be accurate, and links may no longer be available or reliable.
Important:

Amos and Maple will not be licensed by Indiana University beyond June 30, 2023. For help with the transition, contact the UITS Research Applications and Deep Learning team.

To save a variable in your current Maple session to a file, type the following at the Maple prompt:

save varname, `filename.m`;

Replace varname with your variable name, and replacefilename with the name of the file, keeping the .m extension. Also, be sure to use backquotes (`) rather than single quotes ('), which are used to delay evaluation. In some fonts, the two look nearly identical.

Note that the save command saves the variable as a Maple assignment statement. If the value of your variable depends on other variables, you will want to save them as well.

To save more than one variable, give all your variable names to the save command:

save varname1, varname2, varname3, `filename.m`;

The save command no longer has a default that saves all variables. To save all your assigned variables, use the following code:

parse(cat("save ", sprintf("%q", anames(user)), ", `filename.m`"), statement);

You cannot edit a .m file, because it is saved in Maple internal format and is therefore not readable by users. You can, however, save an ASCII file (which can be edited) by saving it without the .m extension. Following are two examples:

  • save varname1, `filename`;
  • save varname1, varname2, varname3, `filename`;

You can then read the file by entering at the Maple prompt:

read `filename`;

Alternatively, you can edit the file with a text editor. You may need to provide the full path to the file.

To learn more, at the Maple prompt, enter:

?save

If you have questions about using statistical and mathematical software at Indiana University, contact the UITS Research Applications and Deep Learning team.

This is document afpn in the Knowledge Base.
Last modified on 2023-10-02 13:46:09.