I have a matrix with size 1887x2048, for each element is a number from 0 to 255. I want to find out how many elements is bigger than 100 and how many smaller than 100 (aka volume fraction)

 Akzeptierte Antwort

Walter Roberson
Walter Roberson am 7 Jun. 2018

0 Stimmen

volumefraction = mean2(YourMatrix>100);

1 Kommentar

Leon Phung
Leon Phung am 7 Jun. 2018
oh wow, I'm trying to write a for loop that switching everything to 0 and 1 to solve this and you just nailed it with a single line, thank you very much.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Aerospace Blockset finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by