# Reading data files with Maple

Maple can read data files and store them in lists which can be used by other Maple functions. Suppose, for example, that we have a file "foo" which looks like this:
```  0 0
1 1
2 0
```
In Maple we execute the command
```  d := readdata( foo, 2 );
```
where the "2" refers to the number of columns. The variable "d" now has the value
```  [[0,0], [1,1], [2,0]]
```
This structure, which we view as a list of (x,y) coordinates, defines a broken-line path. To plot it, we do this:
```  plot(d);
```

Exercise: Picture in your mind's eye the figure which d represents.

Notes
• For all but the smallest files, use a colon instead of a semicolon in order to suppress display. Example:
```  d := readdata( foo, 2 ):
```
• One can plot two or more sets of data at once. For example, if d1 and d2 hold lists of (x,y) pairs, then we can say this:
```  plot( { d1, d2 } );
```
• Consult ?readdata and ?plot for more information.

Last edit by jac , March 27, 1995.
Copyright © 1995 Department of Mathematics, University of Utah