Arduino lookup table...best way to do this?

I'm not sure if this is the best way, but the first thing that comes to mind is to take the value and in a for loop, compare it to the values in an array.
Something like this maybe:

float arrayValues[]={1.25, 2.3, 3.75, 4.22, 5.12};
float measuredValue = 0;
byte x=0;
float y=0;

void setup(){
//setup the motors
}
void loop(){
  measuredValue = analogRead(0);
  for(x=0;x<4;x++){
    y = measuredValue-arrayValues[x];
    if(abs(y)<1)
      break;
  }
  if (x=1){
    //motor A do something
    //motor B do something
  }
 if (x=2){
    //motor A do something
    //motor B do something
  }
   if (x=3){
    //motor A do something
    //motor B do something
  }
   if (x=4){
    //motor A do something
    //motor B do something
  }
}