how to find specific string out of a list in an excel
2 次查看(过去 30 天)
显示 更早的评论
file = read('file');
pattern = strcmp('9',file);
row = find(pattern==1);
writetable(row,'sampletable.txt')
2 个评论
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?
采纳的回答
Walter Roberson
2022-8-8
data = readtable('FileNameGoesHere');
mask = data{:,ColumnNumberGoesHere} == 9;
subset = data(mask,:);
writetable(subset, 'sampletable.txt');
2 个评论
Image Analyst
2022-8-8
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!