How to manipulate single lines in text files without writing the entire file?

2 views (last 30 days)
Hi all,
I need to manipulate single lines in large (~500 MB) text files within a loop. Since reading, manipulating and writing is too time consuming, I am looking for an easier and faster way to manipulate the files. One option is using MS Excel via the actxserver - function. However Excel is limited to about 1 mio lines, which is too little for my purpose.
Hope somebody can help!

Answers (1)

per isakson
per isakson on 12 Mar 2015
If the file has a fixed (and simple) format and "manipulating" doesn't change the size of the file, memmap might be the best way to implement something really fast. See memmap, Map memory for low-level memory read and write operations.

Community Treasure Hunt

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

Start Hunting!