フィルターのクリア

a question on inner loops

1 回表示 (過去 30 日間)
Mnr
Mnr 2016 年 3 月 7 日
回答済み: John D'Errico 2016 年 3 月 7 日
Hello all,
I would like to have 2 for loops such that the outer 1 counts i=1:M and the inner one from j=1:M but j~=i. How can I program this in Matlab? In other words, I would like to have something like
if true
for i=1:M
for j=1:M && j~=i
code
end
end
end

採用された回答

John D'Errico
John D'Errico 2016 年 3 月 7 日
Easy.
for j = setdiff(1:M,i)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by