How do I extract a substring in a cell array of strings?

I have loaded up a catalog of satellite and space debris entries on MATLAB and I am trying to extract everything that is debris.
As you can see in the attachment (column 4), I am trying to run a for loop to look for strings that contain the word 'deb' (and other corresponding fields) and save them separately. But I am just not getting anywhere. Any help would be hugely appreciated.

 Akzeptierte Antwort

KSSV
KSSV am 4 Mär. 2019
[num,txt,raw] = xlsread(myfile) ;
C4 = txt(:,4) ;
idx = contains(C4,'DEB')
Note that for better help, you should attach your file not an image snippet.

5 Kommentare

Abdullah Hamidi
Abdullah Hamidi am 4 Mär. 2019
Bearbeitet: Abdullah Hamidi am 4 Mär. 2019
I tried this but it only verifies whether the string contains the specified strings. I need to extract the specified strings along with their corresponding values in other fields.
I have attached the script but I cannot attach the catalog as this platform does not support json files.
Ohhh...
C4(idx)
The above gives you the respective strings....
Thanks that worked.
Is there any way I could get the values across for those strings (as in the Satellites.JPG, e.g. the corresponding dates and ID numbers)?
Ohhh....simple:
[num,txt,raw] = xlsread(myfile) ;
C4 = txt(:,4) ;
idx = contains(C4,'DEB')
iwant = txt(idx,:)
Perfect!!!
You're a life saver!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by