how to delete data with special value in an array?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Haotian Wang
le 13 Mai 2021
Modifié(e) : per isakson
le 13 Mai 2021
there is an array with 800 values, and the mean of these can be calculated.
I would like to delete the value over or less than 0.5 than the mean of the value. how can I do that?
0 commentaires
Réponse acceptée
per isakson
le 13 Mai 2021
Modifié(e) : per isakson
le 13 Mai 2021
"to delete the value" Do you mean remove? If so, try this script which uses logical indexing
%%
vec = 1+2*randn( 1, 800 ); % sample data
avg = mean( vec );
vec( vec<avg-0.5 | avg+0.5<vec ) = [];
size(vec)
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Types dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!