change negative data to zero in one table in matlab
9 views (last 30 days)
Show older comments
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 Comment
Dyuman Joshi
on 27 Nov 2023
Moved: Dyuman Joshi
on 27 Nov 2023
Find Array Elements That Meet your Condition and assign them to be 0.
Accepted Answer
chicken vector
on 27 Nov 2023
Edited: chicken vector
on 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
More Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!