how to find specific value in a table?
Afficher commentaires plus anciens
if i have hsl table like this, so how to find row that have value = 3 in column 1 (which is 'clusternya')?

i've tried to use
ind1= strfind(hsl.clusternya,'3')
but the error said like this:
Error using strfind
Cell must be a cell array of character vectors.
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 11 Juin 2021
ind1 = find(hsl.clusterya == 3)
But you should probably be considering, for example
mask1 = hsl.clusterya == 3;
dist = sqrt(hsl.v1(mask1).^2 + hsl.v2(mask1).^2)
because using logical masks is generally faster than using find()
Catégories
En savoir plus sur Tables dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!