フィルターのクリア

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

3 ビュー (過去 30 日間)
Arpan Bhattacharya
Arpan Bhattacharya 2020 年 7 月 9 日
回答済み: Apoorv Singh 2020 年 7 月 10 日
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.

回答 (1 件)

Apoorv Singh
Apoorv Singh 2020 年 7 月 10 日
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 :).

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by