Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Interpolation Up: Examples Previous: Displaying Surfaces

Displaying data from a file

Suppose that you have a text file of data (called foo, say) produced by another program. The data is in 4 columns. The 1st column contains x coordinates and the other columns contain 3 sets of y coordinates. You want to display 3 lines on a graph.

First, remove from foo any title headings, etc. Then type 'load foo -ascii' (type 'help load' for more info). This creates a matrix called foo. To check that the matrix has the expected number of rows and columns you can type size(foo). The following command will now produce the required graph.

plot(foo(:,1),foo(:,2), foo(:,1),foo(:,3), foo(:,1),foo(:,4))



© Cambridge University Engineering Dept
Information provided by Tim Love
2006-07-24