行列の中で範囲内の値の数を求めたい
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
kuroshiba
am 17 Feb. 2023
Kommentiert: kuroshiba
am 10 Mär. 2023
[14,5,11;15,10,6;5,12,9]のように3×3行列、9個の要素がある中、9以上20以下の要素は何個あるかを知りたいんですが、どのようなプログラムが必要なのでしょうか。
ご教授いただけると幸いです。
0 Kommentare
Akzeptierte Antwort
Atsushi Ueno
am 17 Feb. 2023
A = [14,5,11;15,10,6;5,12,9]
TF = (A>=9 & A<=20) % 9以上20以下の要素
sum(TF,'all') % 9以上20以下の要素は何個あるかを知りたい
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Multidimensional Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!