Need to find rows with specific strings
조회 수: 4 (최근 30일)
이전 댓글 표시
I am pulling data in from an excel file and need to check which rows contain a specific string of text
data =7150x1 string
I need to know which rows contain 'xyz'
strfind() returns Search term must be a text or pattern scalar
Contains returns just a 0
댓글 수: 2
Image Analyst
2024년 1월 18일
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Dyuman Joshi
2024년 1월 20일
편집: Dyuman Joshi
2024년 1월 22일
As mentioned, unless we have the file to test what happens, it is difficult to suggest anything.
Please share the file you are working with. Use the paperclip button to attach.
Edit -
"Contains returns just a 0 "
@Charles, Could you elaborate on this? Does it return just a 0? Or all 7150 values are 0?
답변 (1개)
Walter Roberson
2024년 1월 20일
편집: Walter Roberson
2024년 1월 20일
mask = contains(data, 'what you are looking for');
selected_data = data(mask);
댓글 수: 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!