Filter löschen
Filter löschen

Need to find rows with specific strings

4 Ansichten (letzte 30 Tage)
Charles
Charles am 18 Jan. 2024
Bearbeitet: Dyuman Joshi am 22 Jan. 2024
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 Kommentare
Image Analyst
Image Analyst am 18 Jan. 2024
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
Dyuman Joshi am 20 Jan. 2024
Bearbeitet: Dyuman Joshi am 22 Jan. 2024
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?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Walter Roberson
Walter Roberson am 20 Jan. 2024
Bearbeitet: Walter Roberson am 20 Jan. 2024
mask = contains(data, 'what you are looking for');
selected_data = data(mask);

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by