Error with Uniquetol: " Repetitive numbers not being removed"
2 views (last 30 days)
I have this double array by the name " GlobalNMesh", I am attaching the file.
It has some repetitive numbers, as shown
I am using
c = uniquetol(GlobalNMesh)
But I am not getting correct results, repetitive numbers are not being removed...
Does anybody know what changes to make?
More Answers (1)
dpb on 19 Jul 2020
Yeah, fix the magnitude of the tolerance interval you want distinguished--by default uniquetol(A) uses 1e-6 for single-precision inputs and 1e-12 for double-precision inputs.
Your values are different only in the 5th/6th position so need a tolerance to reflect that...
>> format long, format compact
0.033640000000000 0.086250000000000 0.000010000000000 0.013160000000000 0.000040000000000
-1 -1 -4 -1 -4
0 0.033640000000000 0.119890000000000 0.133060000000000