read from a text file

1 次查看(过去 30 天)
bahare
bahare 2012-1-17
Hi I have a very big text file containing a huge amount of data, I like to break it down to small parts and read each part separately in order to avoid the 'out of memory' error. is there any idea how to read the data?

采纳的回答

Sven Schoeberichts
Sven Schoeberichts 2012-1-17

更多回答(2 个)

bahare
bahare 2012-1-17
I have already read the help for this command, how ever I did not find any thing relevant to this command, does textscan command breaks down the data in a text file?
  1 个评论
Sven Schoeberichts
Sven Schoeberichts 2012-1-17
C = textscan(fid, 'format', N) reads data from the file, using the format N times, where N is a positive integer. To read additional data from the file after N cycles, call textscan again using the original fid.
So it reads N lines. If you run the function again, it takes off where it ended, so you can use a loop to run through your data.

请先登录,再进行评论。


bahare
bahare 2012-1-18
Thanks, I tried to read the text from the line 1 to the line 100000, and then from 100001 to 200000, and so on, so I wrote my code in the following way: C=textscan(fopen('aug'),'%f %s', 100000, 'delimiter',',')); so how should I write to read the line 100001 to 200000 and then from line 200001 to 300000?

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by