Reading text file from MATLAB

Hello,

How to read a text file from MATLAB? Well, it’s simple. Just this:

array = textread('filename'); 

The array variable may holds a multidimensional matrix. If your file, for instance, has 3 columns where 1st one are formed by float-point, the 2nd one by integer and the 3rd one formed by string, you can do this:

[a, b, c] = textread('filename', '%f%d%s')

Each a, b and c are arrays of each type: float, decimal and string.

That’s all,

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s