Effacer les filtres
Effacer les filtres

if i==any elements in M

2 vues (au cours des 30 derniers jours)
Patrick
Patrick le 19 Mar 2015
Say I have a nX1 matrix M, i want to use condition, "if i==any elements in M", what should I type in Matlab?

Réponse acceptée

Star Strider
Star Strider le 19 Mar 2015
You’re almost there!
Try this:
M = randi(100, 250, 1);
k = 42;
if any(M == k)
fprintf('\n\t\t\tEUREKA!\n')
end

Plus de réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by