My question is as follows: I get some random measured values and I want to round them to a scale I have predefined. One solution to this is:
CoolingCapacity = [2,5,10];
CoolingC = [1,2.3,5.3,7.2,10.2,12.2];
if CoolingC < 2.5
tempCooling(i) = 2;
elseif CoolingC >= 2.5 && CoolingC <7.5
tempCooling(i) = 5;
elseif CoolingC >=7.5
tempCooling(i) = 10;
It could be solved like this, but is there a easy way to round to nearest number in a fixed vector?
RoundToNearest(CoolingCapacity,CoolingC) And it returns the rounded vector?
Im not sure if my question is clear. Else be free to ask me and ill answer.