if i==any elements in M
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Patrick
am 19 Mär. 2015
Beantwortet: Star Strider
am 19 Mär. 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?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 19 Mär. 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
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Interpolation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!