How Do I
Import Tabular Data?
Data Import Assistant
Maple supports many different import and export file formats including csv, tsv, Excel, ods, and more.
To see a full list of supported formats, see the Formats help page.
Many commands support importing data files directly from files stored on disk or online. Maple stores many sample data files in the Maple data directory. This directory can be found under "data" in the Maple installation folder.
The Import command provides a generic mechanism for importing data in various file formats. The source data can be an external file or URL or a string or ByteArray in the current session. The form which the imported data takes in Maple is determined by the format (either inferred or specified by the format option) and the output option. By default, Import returns a DataFrame object when importing from the following rectangular formats: Excel, CSV, DIF, TSV. Additionally Import returns a DataSeries object by default when importing from the SXC or TSV formats.
Import comma-separated tabular data as a DataFrame.
csvFile â‰” FileTools:-JoinPath⁡datasets,iris.csv,base=datadir:
Import data directly from an input string while specifying the CSV format.
CityData â‰” City,Population
The ImportMatrix command can also be used to import tabular data and store the data as a Vector or Matrix. In contrast to the Import command, the ImportMatrix command assumes that the incoming data is tabularly structured information, and cannot be used to import images, or other file types.
Import a MATLAB® ASCII data file with entries format.
matlabFile â‰” FileTools:-JoinPath⁡example,MatlabData.txt,base=datadir:
A â‰” ImportMatrix⁡matlabFile,source=MATLAB,format=entries,transpose=true
The Import command in the ExcelTools package is designed for working with Excel spreadsheet files providing a mechanism to import full spreadsheets or specific ranges of cells stored in Excel spreadsheets.
It is also possible to import information in other spreadsheets in the file as well as specify cell ranges:
readdata and scanf
The readdata command reads numeric data from a text file into Maple. The data in the file must consist of integers or floating-point values arranged in columns, separated by white space, and it is returned in a list or list of lists.
The scanf command allows you to read from the terminal using a specified format. The formatting information is provided by a format string.
The sscanf command below reads an integer, a space, a character, and a floating-point value from the string given as the first argument.
sscanf("892 123.456E7","%d %c%f");
Several format codes are available for use with scanf. A few of the more commonly used ones are mentioned here.
"d" -- integer
"f" -- floating-point number
"c" -- character
"s" -- string
"a" -- Maple expression
The Import Data Assistant is an interactive interface to import external data into Maple. You can also launch the dialog from the menu bar. From the Tools menu, select Assistants and then Import Data.
The Data Set Search assistant is an interactive graphical interface for searching built-in and online data sources.
It is possible to search for available data sources from Maple's help search box:
The How Do I... topics cover the essentials for doing mathematics in Maple. Learn more about available tools and features, such as palettes and the context panel.
How Do I...
...Enter a Complex Number?
...Enter a Function?
...Enter a Matrix?
...Enter a Simple Expression?
...Evaluate an Expression?
...Plot a Function?
...Plot a Straight Line?
...Plot Multiple Functions?
...Solve an Ordinary Differential Equation?
...Work with Random Generators?
Tools and Features
Refer to Help>Quick Reference for basic Getting Started tips.
Input and Output: Programming Guide, Chapter 10
Maple add-in for Excel
Download Help Document