Azzera filtri
Azzera filtri

how to use "or"

1 visualizzazione (ultimi 30 giorni)
Max Müller
Max Müller il 5 Ago 2014
Risposto: Andrei Bobrov il 5 Ago 2014
Can u pls tell me what is wrong ( just an example) How do i use the or command ?
for i = 1:100
if i == 2|5
disp('hallo')
end
end

Risposta accettata

the cyclist
the cyclist il 5 Ago 2014
for i = 1:100
if (i == 2)|(i == 5)
disp('hallo')
end
end

Più risposte (1)

Andrei Bobrov
Andrei Bobrov il 5 Ago 2014
for ii = 1:100
if ii == 2 || ii == 5
ii
disp('hallo')
end
end
or
for ii = 1:100
if ismember(ii,[2,5])
disp('hallo'),ii
end
end

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by