필터 지우기
필터 지우기

About a for loop matrix

조회 수: 1 (최근 30일)
Ming Ki Lee
Ming Ki Lee 2017년 1월 25일
편집: Walter Roberson 2017년 1월 25일
for k=2:mx-1
for j=2:mx-2
A(k,j-1) = (D*dt)/dx^(2)+U*dt/(2*dx);
break
end
break
end
I set there is a zeros matrix with mx column and mx row and I want to find the points (2,1), (3,2), (4,3), (5,4) etc. Now it only show 1 column at (2,1) point. But if I delete two breaks, it will keep loop the second loop. How can I fix this???

채택된 답변

Walter Roberson
Walter Roberson 2017년 1월 25일
편집: Walter Roberson 2017년 1월 25일
for k=2:mx-1
j=k+2;
A(k,j-1) = (D*dt)/dx^(2)+U*dt/(2*dx);
end

추가 답변 (0개)

카테고리

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