필터 지우기
필터 지우기

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

조회 수: 3 (최근 30일)
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 CenterFile Exchange에서 Text Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by