What does "undefined eq" means on fixed.Interval command

2 次查看(过去 30 天)
Hello, I'm trying to write a switch case with intervals but I keep gettin this error: Undefined function 'eq' for input arguments of type 'fixed.Interval'. I don't know what that means. I'll attatch the code I'm trying to run.
unitVc=app.DropDownVC.Value;
switch unitVc
case app.Vc.Value==fixed.Interval(0,60)
f=warndlg('El Volumen de carga debe ser menor o igual a 60 L');
end
UnitVc, DropDownVc and app.Vc.Value were previously defined. Thanks

回答(1 个)

Walter Roberson
Walter Roberson 2023-3-9
switch true
case ~contains(fixed.Interval(0,60), unitVc)
but are you sure it is wise to use the Fixed Point Designer facilities for a UI task? Wouldn't it make more sense to test
switch true
case unitVc < 0 | unitVc > 60
  3 个评论
Walter Roberson
Walter Roberson 2023-3-9
Does your dropdown have entries such as '100L' or '100 L' ? Entries such as '0.03 m³' in the same dropdown ?? Entries with negative numbers ?? Entries where the number is not the first thing in the entry?
If your entries are text then you should
Vc_okay = false;
switch unitVc
case {'-400 L', '-0.4 m³', '0 L', '0 m³', '75 L', '0.75 m³', '100 L', '1 m³', '250 L', '2.5 m³'}
f = warndlg('El Volumen de carga debe ser menor o igual a 60 L / 0.06 m³');
otherwise
Vc_Okay = true;
end
Giulia Di Giorgio
No, I'm going to attach my app so I can show you how it looks. I have to units: L and m³ and I want that volume to be between 0 and 60 liters or 0 and 0.06 m³, that's what I tried to program on the code above.

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by