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

 채택된 답변

the cyclist
the cyclist 2014년 8월 5일

0 개 추천

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

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2014년 8월 5일

0 개 추천

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

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2014년 8월 5일

답변:

2014년 8월 5일

Community Treasure Hunt

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

Start Hunting!

Translated by