reading a text file

1 view (last 30 days)
Muhammet Ayanoglu
Muhammet Ayanoglu on 1 Jan 2012
Hello everybody, I'm totally new user of MATLAB. I have a problem about reading a text file. I have a text file which has about 9000 rows. There are strings,numerical values, characters etc. I just want to take some necessary part from the text file. I realise that the necessary part starts the word "1tally". I need to take the 200 rows. There are 3 regions like this. In different location in the text file. But all of the regions starts 1tally and necessary part for me starts this row to the next 200 rows. How can I take these 600 rows from the text file which located on different place in the file??
  1 Comment
TAB
TAB on 2 Jan 2012
Please post example of text data, so that we can suggest code for its manipulation.

Sign in to comment.

Answers (1)

nanren888
nanren888 on 1 Jan 2012
Well, basically you are going to have to program it. Perhaps parse lines & select the lines you need. Maybe start with help textscan It may help if you know what the delimiter is in the file: eg, one space, commas. At the bottom of the help there are listed some other file IO functions that could be of use if textscan's all encompassing way does not suit you for some reason.

Community Treasure Hunt

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

Start Hunting!