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 ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by