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

댓글 수: 2

madhan ravi
madhan ravi 2020년 8월 27일
What’s your question?
Aaron Aguilar
Aaron Aguilar 2020년 8월 27일
i want to add a count of elements greater than 20 and less than 70 for a 10x10 matrix

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

답변 (1개)

madhan ravi
madhan ravi 2020년 8월 27일

0 개 추천

[row, column] = deal(1:10);
Counts = nnz(((row .* column(:)) > 70) & ((row .* column(:)) < 20))

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 8월 27일

답변:

2020년 8월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by