Why do I receive a given error?
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (1 件)
Torsten
2024 年 3 月 29 日
編集済み: Torsten
2024 年 3 月 29 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!