Matlab randomly adds trailing zeros to integers (see example below). Subsequently it does not accept these values as indices in a vector leading to errors.
if true 4.82*100-101ans = 381>> 4.81*100-101ans =380.0000>> 4.80*100-101ans = 379end
If I use these results as indices in a vector 381 and 397 work fine but 380.000 doesn't. Why does matlab add those zeros? All results should be integers. How do I prevent this from happening?
Best Answer