フィルターのクリア

How to select certain data from .txt file

10 ビュー (過去 30 日間)
Mech Stud
Mech Stud 2018 年 3 月 22 日
コメント済み: Mech Stud 2018 年 3 月 22 日
I have text file with three columns and a lot of rows. The third column has a value of either 1 or 0. I want to choose the rows for which the third column is 0 and write it in a new text file.

採用された回答

Guillaume
Guillaume 2018 年 3 月 22 日
Probably the easiest, assuming your text file format is straightforward to decode:
filecontent = readtable('c:\somewhere\somefile.txt'); %readtable should be able to figure out the format on its own
filteredcontent = filecontent(filecontent{:, 3} == 0, :); %keep content where 3rd column is 0
writetable(filteredcontent, 'c:\somewhere\newfilename.txt'); %and save
  1 件のコメント
Mech Stud
Mech Stud 2018 年 3 月 22 日
Thanks much.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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