Extract specific info out of file

조회 수: 1 (최근 30일)
Corneel Lootens
Corneel Lootens 2022년 8월 17일
댓글: Corneel Lootens 2022년 8월 17일
Hi,
I have a file (txt file) with info, for example kids and their scores. String (name), Int (scores), String (passed/notpassed).
For example,
Jessica 8 passed
Tom 6 passed
Ronald 4 notpassed
My question now is how can I extract the ones who passed the test and with that their scores in a new Array/File/other?
Thanks in advance

채택된 답변

dpb
dpb 2022년 8월 17일
txt=readlines('yourfile.txt');
writematrix('yournewfile.txt',txt(~contains(txt,'notpassed')),'filetype','text','quotestrings',0);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 String Parsing에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by