フィルターのクリア

how to use "or"

1 回表示 (過去 30 日間)
Max Müller
Max Müller 2014 年 8 月 5 日
回答済み: Andrei Bobrov 2014 年 8 月 5 日
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 日
for i = 1:100
if (i == 2)|(i == 5)
disp('hallo')
end
end

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2014 年 8 月 5 日
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

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by