Extract values from a matrix

2 vues (au cours des 30 derniers jours)
Patrick Chow
Patrick Chow le 15 Nov 2019
let say I have a matrix:
[ 3 2 4 ; 3 5 1]
I want to extract all the values that are greater than 3 and use all these extracted values to find the mean value.
How should I approach this?

Réponse acceptée

Guillaume
Guillaume le 15 Nov 2019
mean(yourmatrix(yourmatrix >= 3)) %mean of all values greater than or equal to 3

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by