フィルターのクリア

add count in a for loop

1 回表示 (過去 30 日間)
Aaron Aguilar
Aaron Aguilar 2020 年 8 月 27 日
回答済み: madhan ravi 2020 年 8 月 27 日
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 日
[row, column] = deal(1:10);
Counts = nnz(((row .* column(:)) > 70) & ((row .* column(:)) < 20))

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by