Reading in delimited text files

| categories: basic matlab | View Comments

Reading in delimited text files

Reading in delimited text files

sometimes you will get data in a delimited text file format, .e.g. separated by commas or tabs. Matlab can read these in easily. Suppose we have a file containing this data ( download testdata.txt ):

1   3
3   4
5   6
4   8
% this is how you read it in.
A = textread('testdata.txt')

x = A(:,1);
y = A(:,2);

% you can do what ever you want with this data now. Plot it, integrate it,
% etc...

% categories: Basic matlab
% post_id = 722; %delete this line to force new post;
A =

     1     3
     3     4
     5     6
     4     8

blog comments powered by Disqus