Notice! This document is currently in
Archived
status.
The content of this document may be incorrect or outdated.
The content of this document may be incorrect or outdated.
Print this article Edit this article
Plot a file of data points in MATLAB
Matlab is actually quite useful even for things as simple as plotting a file of data points. First you'll need a file with all the proper values. Let's say you have a file with all your data, arranged like this:
x1 y1Let's additionally say that the name of the file is "test.dat". To load the data into matlab you would type the following at the matlab prompt:
x2 y2
x3 y3
.. ..
xn yn
load test.dat
Then "test" becomes a matrix where the first column is X and the second column is Y. To plot this, you can type:
plot( test(:,1), test(:,2) )
Where "test(:,1)" means "the entire first column of matrix test".
Last Modified:
Dec 19, 2016 11:12 am US/Eastern
Created:
Mar 20, 2007 4:57 pm GMT-4
by
admin
JumpURL: