A basic question about the counter
Infos
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Afficher commentaires plus anciens
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
Réponses (1)
madhan ravi
le 11 Juin 2020
counts = 0; % before loop
counts = counts + 1; % inside else part
Cette question est clôturée.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!