possible to use logical indexing with an array argument ?

is there a way I can convert this code
for i=1:15653
label == i
end
to a vectorized one ?
i=1:15653;
label == i

1 commentaire

Stephen23
Stephen23 le 17 Jan 2017
Modifié(e) : Stephen23 le 17 Jan 2017
What is wrong with
i=1:15653;
label == i
?
What do you want to do with this?

Connectez-vous pour commenter.

 Réponse acceptée

John Chilleri
John Chilleri le 17 Jan 2017
Modifié(e) : John Chilleri le 17 Jan 2017
Hello,
WhateverYouWant = (label == 1:15653);
Note: assuming label is also a 15653 length vector OR a scalar.
Hope this helps!

2 commentaires

Sorry I was sure it didnt work when I typed
la
label == i
earlier on
No worries! Glad I could help!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Characters and Strings 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!

Translated by