According to the error message, MotorSpeed, SleepSpeedThreshold_int_dbl and/or Tref_Ramp are arrays, not scalars.
So if you want to have all elements of Motor_Speed to be smaller or equal than the corresponding elements of SleepSpeedThreshold_int_dbl and all elements of Tref_Ramp to be equal to 0, use
if all(Motor_Speed(:) <= SleepSpeedThreshold_int_dbl(:)) & all(Tref_Ramp(:) == 0)
