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

 Akzeptierte Antwort

the cyclist
the cyclist am 5 Aug. 2014

0 Stimmen

for i = 1:100
if (i == 2)|(i == 5)
disp('hallo')
end
end

Weitere Antworten (1)

Andrei Bobrov
Andrei Bobrov am 5 Aug. 2014

0 Stimmen

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

Kategorien

Mehr zu MATLAB finden Sie in Hilfe-Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by