MATLAB: While loop until x amount correct digits

while

Hi
Can someomene give me an example or an general way to write a while loop where the condition is that you need to have 3 correct decimals. ?
In my code I have a for loop but I need to make it more adapt.

Best Answer

Have you considered using built-in function 'round'?
Then you can just do:
if round(x,3) == round(y,3)
...
end