Access Keys:
Skip to content (Access Key - 0)

How do I input and output data using Maple?

On this page:

Overview

The routines described here are best for raw data input and output. To save your Maple session or export data in a different format, please see "How can I save, restore and export information with Maple?". A brief description of each routine follows; use the online
help for more information.

Input

  • "readline" reads a single line from a file or the terminal, and returns it as a string. You can then parse this with "sscanf" or the "parse" function (for Maple expressions).
  • "readdata" reads a text file containing numbers separated by tabs or spaces, and returns it as a list. You can specify which columns to read, and whether to treat them as integers or floats.
  • "fscanf" "sscanf" and "scanf" are based on the C standard library functions of the same names for formatting input. The Maple versions of these functions each return a list.
  • "readbytes" reads a specified number of bytes from a file, and returns either a list of integers or a string of characters.

Output

  • "writeline" writes strings to a file or the terminal.
  • "writedata" is used to write numerical data to a text file.
  • "fprintf" "sprintf" and "printf" are based on the C standard library functions of the same names; these allow you to control the format of output. There is also an "nprintf" which returns a Maple symbol rather than a string.
  • "writebytes" writes the bytes from a string of characters or list of integers to a file (the file is opened with type text or binary, respectively).

IS&T Contributions

Documentation and information provided by IS&T staff members


Last Modified:

December 16, 2010

Get Help

Request help
from the Help Desk
Report a security incident
to the Security Team
Labels:
olc-maple olc-maple Delete
maple maple Delete
data data Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
Feedback
This product/service is:
Easy to use
Average
Difficult to use

This article is:
Helpful
Inaccurate
Obsolete
Adaptavist Theme Builder (4.2.3) Powered by Atlassian Confluence 3.5.13, the Enterprise Wiki