A basic question about the counter
Info
This question is closed. Reopen it to edit or answer.
Show older comments
Hello, here I have some part of my code. The thing is I want to count the code after 'else'. I can put counter, yes but It counts the total usage of that line. I want to see how many times it is being used in each row of the matris 'vertices'. I mean seperately for each row.
for M=1:m %color
for d=1:D
if abs(left_side(M,1)-vertices(d,1))<0.3 && abs(left_side(M,2)-vertices(d,2))<0.2
if vertices(d,4)==0;
vertices(d,4)=left_side(M,4);
else vertices(d,4)=(vertices(d,4)+left_side(M,4));
end
end
end
end
Answers (1)
madhan ravi
on 11 Jun 2020
counts = 0; % before loop
counts = counts + 1; % inside else part
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!