Searching using loop in matlab

조회 수: 1 (최근 30일)
Sudharsan Srinivasan
Sudharsan Srinivasan 2017년 11월 9일
답변: Jan 2017년 11월 9일
I have n (number of particles) = 1:10. These particles flow in the system and i want to check if for certain condition is satisfied, then the particles collide and I compute collision. Importantly, I have to check every possible combinations of n for collision to happen. Any suggestions on how can I do this in a loop ?
  댓글 수: 2
KL
KL 2017년 11월 9일
what is your condition?
Jan
Jan 2017년 11월 9일
Is the number of particles 1:10 or simply 10?

댓글을 달려면 로그인하십시오.

답변 (1개)

Jan
Jan 2017년 11월 9일
Perhaps you mean this:
for i1 = 1:10
for i2 = 1:10
if i1 ~= i2
check collision between the particle i1 and i2
end
end
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by