MATLAB: How to round a large array to the nearest factor of 0.0064

nearest factorround

Hi, I have an array of data that is a 92246×1 double. The data has been retrieved from a sensor that is outputting in what appears to be steps of 0.0064V. This data has some noise present so I am wanting to round the data to the nearest interval of 0.0064V, what is the easiest way to do this? Thanks in advance

Best Answer

I am not certain what you want.
Three options:
A = rand(20,1); % Create Data
R1 = rem(A, 0.0064);
R2 = quant(A, 0.0064);
R3 = round(A/0.0064);
Q = [A, R1, R2, R3]; % Compare Results
The quant (link) function is now (in R2018b) in the Deep Learning Toolbox. I have no idea where it was in earlier releases.