change negative data to zero in one table in matlab
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mounira
le 27 Nov 2023
Déplacé(e) : Dyuman Joshi
le 27 Nov 2023
Hello,
so i have table with negative values and also with some values above zero but very small, for example: 0.00001 and i want these values to be zero in the table,
can i make some kind of a code or what?
thanks in advance
1 commentaire
Dyuman Joshi
le 27 Nov 2023
Déplacé(e) : Dyuman Joshi
le 27 Nov 2023
Find Array Elements That Meet your Condition and assign them to be 0.
Réponse acceptée
chicken vector
le 27 Nov 2023
Modifié(e) : chicken vector
le 27 Nov 2023
% Create fictitious set of data:
tableData = rand(1e1) - .5
% Define tolerance under which data is set to zero:
tol = 1e-2;
% Udpate table:
tableData(tableData<=tol) = 0
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Logical 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!