add count in a for loop
조회 수: 1 (최근 30일)
이전 댓글 표시
for Row = (1:10)
for Column = (1:10)
fprintf('%d\t',Row*Column);
end
fprintf('\n');
numberofelements = sum(Row*Column(:)<70)+ Row*Column(:)>20);
end
답변 (1개)
madhan ravi
2020년 8월 27일
[row, column] = deal(1:10);
Counts = nnz(((row .* column(:)) > 70) & ((row .* column(:)) < 20))
댓글 수: 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!