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

3 vues (au cours des 30 derniers jours)
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.

Réponses (1)

Apoorv Singh
Apoorv Singh le 10 Juil 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 :).

Catégories

En savoir plus sur Text Data Preparation dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by