フィルターのクリア

Is it possible to delete a line from a text file where a specific string exists?

7 ビュー (過去 30 日間)
Recap
Recap 2016 年 4 月 5 日
コメント済み: Recap 2016 年 4 月 5 日
I'm trying to delete a line from a text file where the inputted word exists. For instance, my text file contains the following
10-D-0343 14.01.10 04-Apr-2016
11-W-282 14.21.50 04-Apr-2016
01-D-5693 14.58.40 04-Apr-2016
and I input the string 10-D-0343. How can I delete the whole line or even the 2 strings that follow it? So i would get
11-W-282 14.21.50 04-Apr-2016
01-D-5693 14.58.40 04-Apr-2016

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2016 年 4 月 5 日
M={'10-D-0343' '14.01.10' '04-Apr-2016'
'11-W-282' '14.21.50' '04-Apr-2016'
'01-D-5693' '14.58.40' '04-Apr-2016'}
M(any(ismember(M,'10-D-0343')),:)=[]
  1 件のコメント
Recap
Recap 2016 年 4 月 5 日
I guess that can work since I can then take M and write it to the text file. Thank you

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by