How to read a specific line from multiple text files and save as an 'output.csv' file?

3 Ansichten (letzte 30 Tage)
I have multiple text files. I want to read a particlar line from those text files and combine them together in a separate text file as an output. If I want to read line number 69 from each files and write in a separate text file (or csv) as an output, How can I do that? I have attached three text files and I am expecting output like I have attached.

Antworten (1)

Apoorv Singh
Apoorv Singh am 10 Jul. 2020
For each text file, you can read the contents line by line (link). Reading a specific line number could be done by using a normal counter variable. Once you have the contents of the line, save it to an array. You can then write the contents to a csv file using writematrix (link).
Hope this helps :).

Kategorien

Mehr zu Text Data Preparation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by