Files and Filenames
Maple Language Files
Internal Format Files
Examples: Opening a File
Maple handles a variety of files. The two main categories of files are those used implicitly by Maple and those used explicitly with Maple I/O functions. Files used implicitly by Maple are described in this help page. For information on files used explicitly, see file_types.
For information regarding filenames, see the Filenames section in this help page.
A Maple language file contains statements conforming to the syntax of the Maple language. These are the same as statements that can be entered interactively. Any filename can be used for a Maple language file, but the name cannot end with the two characters .m (or .M on platforms such as Windows, where filenames are not case-sensitive). The standard file extension for Maple language files is .mpl.
Maple language files can be created using a text editor or the save statement. Maple procedures and complex scripts of commands are usually written in a text editor. The save statement is used to save results or procedures that were entered into Maple interactively.
Maple language files may be read using the read statement. The statements within the file are read as if they were being entered into Maple interactively, except that they are not echoed to the screen unless interface(echo) has been set to 2 or higher. For information on the interface command, see interface.
Maple includes a preprocessor modeled on the C preprocessor. Maple language files may include preprocessor directives ($include, $define).
Maple internal format files are used to store procedures and objects in a more compact, easy-for-Maple-to-read format. Objects stored in internal format can be read by Maple faster than objects stored in Maple language format.
Maple internal format files are identified by filenames ending with the two characters .m (or .M on platforms where filenames are not case sensitive).
Maple internal format files are created using the save statement with a filename parameter (see save) ending in .m.
Note: Because "." is a special character, the filename must be enclosed in quotes, either double quotes or left single quotes (backquotes).
Maple internal format files are read using the read statement. The fact that the specified filename ends in ".m" tells Maple that the file is in internal format.
Generally, the format of internal files changes with each new release of Maple in order to accommodate new features. However, any given release of Maple is able to read at least the previous release's internal file format.
All versions of Maple released in 1995 or later have an internal format consisting entirely of printable characters. This enables internal format files to be transferred by such media as electronic mail.
Because Maple internal format files are generally rather small, and because the Maple library consists of thousands of such files, keeping the library as a large number of separate files does not make good use of disk space (since most disks allocate a large minimum amount of space to a file). Therefore, the library is kept in a small number of Maple library archive (.mla) files.
The main archive consists of the single maple.mla file. There are other archives, including Maplets.mla, Physics.mla, and units.mla. Maple .mla files contain Maple code and are self-contained. In Windows and Mac, an archive file can be opened by double-clicking it. In UNIX, the file can be opened from the command line by entering xmaple filename.mla.
When files are read from the library, they are automatically read directly from the archive into Maple. Likewise, when internal format files are written to a library directory, they are automatically written directly into an archive if one exists. Library archives can be further manipulated using LibraryTools package commands or the march utility.
.lib and .ind files
The Maple .lib format is a legacy format similar to a .mla file. However, unlike .mla files, which are self-contained, .lib files have an associated .ind file. All commands used with .mla files may also be used with .lib files.
A Maple help database (.help file) is a file that stores a collection of files that represent help pages in the Maple help system. It contains the information required to index, navigate, and search the help system. For more information, see About Help Databases in Maple.
Maple worksheets can be saved as .maplet files. The MapletViewer runs .maplet files independent of the Maple worksheet environment. For more information, see MapletViewer and Save a Worksheet As.
If you are using Maple with a graphical user interface, you can save your worksheet. In the Standard Worksheet interface, files are identified by names ending with .mw. In the Classic Worksheet interface, files end in .mws. Both types of files are portable between the graphical user interfaces on different platforms.
If you are using the standard graphical user interface, you can save collections of worksheets, variables and attachments in a workbook. Workbook files are identified by names ending with .maple. See .maple for more information on the workbook format.
In places where Maple expects a filename, a string should be used.
The commands FileTools[SplitPath] and FileTools[JoinPath] can be used to construct file paths in a system-independent way.
Consult your system documentation for details on file naming rules and conventions for your computer platform.
Workbooks additionally accept a URI for referencing an attachment within a workbook.
Open a file for reading on a UNIX or Mac system.
f := fopen( "/usr/local/maplelocal/Project/Top.txt", READ ):
A similar example on a Windows system.
Note to Windows users: when typing filenames, which use the backslash as a directory separator, you can either type each backslash as two backslashes, or you can use forward slashes.
f := fopen( "C:\\maple.local\\Project\\Top.txt", READ ):
f := fopen( "C:/maple.local/Project/Top.txt", READ ):
Also, all backslashes in a filename are automatically converted to forward slashes when you paste a valid Windows filename into a command in a worksheet. For a filename to be valid, the file must exist.
About Help Databases in Maple
Save a Worksheet As
Download Help Document
What kind of issue would you like to report? (Optional)