Parser.

5 views (last 30 days)
Victor Buza
Victor Buza on 17 Nov 2011
I am trying to find/write something that will take a data file that has some data sets in it and some text, names of data sets; and give me only the data, without the text, such that I can work with it further (assign a specific column to do a specific thing). How do I get rid of the text? I have tried having a look at inputparser, but have a hard time understanding how I can implement it, or am I looking at the wrong thing?

Accepted Answer

Fangjun Jiang
Fangjun Jiang on 17 Nov 2011
It depends. If the contents in the text file have a consistent format, many times using d=importdata('DataFile.txt') is sufficient to put the numerical data and text data aside. You can even use d=uiimport to go through it once manually and have the option to generate the code for it so you can apply it to other similar files.
If the format is not consistent, using textscan(fid,'%f') can skip the text strings.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!