change negative data to zero in one table in matlab
10 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Mounira
il 27 Nov 2023
Spostato: Dyuman Joshi
il 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 Commento
Dyuman Joshi
il 27 Nov 2023
Spostato: Dyuman Joshi
il 27 Nov 2023
Find Array Elements That Meet your Condition and assign them to be 0.
Risposta accettata
chicken vector
il 27 Nov 2023
Modificato: chicken vector
il 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
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Logical in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!