How can I get this 'for loop' to work?

for TH = 0:0.1:1
AB = DC > big*TH
end
Where: DC is a matrix. big is a variable(already set).
What I'm trying to do is to scan through TH in steps of 0.01, do a pair-wise comparision and add the results to AB in 1s and 0s. The statement itself works flawlessly but when I put it in the for loop it doesn't returns, only 0s.
I'm new to Matlab, so it might have so obviously stupid mistake that I don't realise. Please help.
Thx.

댓글 수: 2

Matt Kindig
Matt Kindig 2013년 5월 6일
You are overwriting the value of AB each time the loop is run. Accordingly, the value of AB when the loop is complete is the value of AB = DC > big*1.
Since AB is a matrix as well, it is a bit unclear how you want it to be modified with each loop iteration. Do you want to AND AB each time, OR it, or something else?
Ajet
Ajet 2013년 5월 6일
Well every time AB is overwitten I want take that matrix and process it for some results(SUM of the points where AB=1) and do the same processing for the next AB. All those results will then go into a different vector so that I can graph it.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2013년 5월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by