In Maple, how do I save variables?

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 replace filename 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 Research Analytics. Research Analytics is located on the IU Bloomington campus at Woodburn Hall 200; staff are available for consultation Monday-Friday 9am-noon and by appointment.

This is document afpn in the Knowledge Base.
Last modified on 2015-05-20 00:00:00.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.