Import data from CSV file problem

2 views (last 30 days)
Anuraag
Anuraag on 16 Aug 2011
Hi everyone,
I have a small job related problem that I want to discuss. My task is to read several CSV files using matlab and compile the information in an excel sheet. I already have a piece of code that I am supposed to improve on but I have a slight problem. The raw CSV files that I am supposed to compile have a line of text in every 100 lines of data but the command importdata that I have used only reads upto a 100 lines of data (i.e. all data before the first line of text appears) and moves on to the next file without reading the rest of the data in the file. I am fairly new to importing data in matlab and would appreciate any kind of help.
Thanking you in advance.
  2 Comments
Oleg Komarov
Oleg Komarov on 16 Aug 2011
Does the line of text always start in the same way?
Fangjun Jiang
Fangjun Jiang on 16 Aug 2011
I guess Oleg's intent is that if those text lines always start with something common such as // or ** or any other keyword, you can use dlmread() with the 'commentstyle' option to ignore them.

Sign in to comment.

Answers (1)

the cyclist
the cyclist on 16 Aug 2011
I like to use the readtext() command from the FEX for importing mixed text/numeric files:

Community Treasure Hunt

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

Start Hunting!