Why do I receive a given error?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
if (((Motor_Speed)<=(SleepSpeedThreshold_int_dbl))&&(Tref_Ramp ==0))
timer_KeyOFF = timer_KeyOFF + 0.01;
else
timer_KeyOFF =0;
end
For above code getting a given error
Expected a scalar. Non-scalars are not supported with logical operators. Instead, use ALL to convert matrix logicals to their scalar equivalents. State 'KeyOFF' in Chart 'State_Machine/Control Algorithm': if (((Motor_Speed)<=(SleepSpeedThreshold_int_dbl))&&(Tref_Ramp ==0))
0 Commenti
Risposte (1)
Torsten
il 29 Mar 2024
Modificato: Torsten
il 29 Mar 2024
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)
0 Commenti
Vedere anche
Categorie
Scopri di più su Structures in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!