how to find specific string out of a list in an excel

조회 수: 2 (최근 30일)
Ihaveaquest
Ihaveaquest 2022년 8월 8일
편집: Ihaveaquest 2022년 8월 9일
file = read('file');
pattern = strcmp('9',file);
row = find(pattern==1);
writetable(row,'sampletable.txt')
  댓글 수: 2
Walter Roberson
Walter Roberson 2022년 8월 8일
Are you starting with a .csv file or a .xlsx file?
Are there multiple columns in the file? Should only one column be examined for a match? Should the entire row with the match be output? Is it possible that multiple rows will match?
Ihaveaquest
Ihaveaquest 2022년 8월 8일
yes and yes yes yes yes to all .. csv file with 1000lines but theres a column with value 9 and 17 that i need the full like row info
thank you

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2022년 8월 8일
data = readtable('FileNameGoesHere');
mask = data{:,ColumnNumberGoesHere} == 9;
subset = data(mask,:);
writetable(subset, 'sampletable.txt');
  댓글 수: 2
Ihaveaquest
Ihaveaquest 2022년 8월 8일
편집: Ihaveaquest 2022년 8월 9일
thank you! it works great!
Image Analyst
Image Analyst 2022년 8월 8일
@Juan you again forgot to attach your data file and say what string pattern you're looking for. So that leads me to believe you did not read the Community Guidelines or Tutorial.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by