I want to repeat this code 32 times and each time stores the result to get matrix 1*32
조회 수: 1 (최근 30일)
이전 댓글 표시
counter=0;
for i=1:256
for j= 1:256
if L(i,j) == k
counter= counter+1;
end
end
end
댓글 수: 0
채택된 답변
Geoff Hayes
2020년 5월 14일
Osama - presumably you want to store the counter value from each of the 32 iterations so you could do something like
n = 32;
counter = zeros(n,1);
for m = 1:n
for i=1:256
for j= 1:256
if L(i,j) == k
counter(m) = counter(m) + 1;
end
end
end
end
I'm assuming that there is some missing code since the above will produce the same result (i.e. all elements of counter will be identical) for each of the 32 iterations.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!