How do I access entries in a table that match a string?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Pratik Samant
il 28 Feb 2020
Modificato: Jeff Miller
il 29 Feb 2020
I have a table, A, which is 112x5 table in size and consists of both strings and numbers. (shown below)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274261/image.png)
I also have a 99x1 cell, nameFolds, which is a series of labels for the entries in a that I'm interested in. namefolds is shown below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/274262/image.png)
What I want to do is extract the 'zone' label from A, for all entries matching nameFolds. I tried to start this using boolean expressions but was given an error saying "Undefined operator '==' for input
arguments of type 'cell'".
Thanks
0 Commenti
Risposta accettata
Jeff Miller
il 29 Feb 2020
Modificato: Jeff Miller
il 29 Feb 2020
This should work:
wantedRows = ismember(A.ProxID,nameFolds);
wantedZones = A.zone(wantedRows);
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!