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

조회 수: 8 (최근 30일)
Giulia Di Giorgio
Giulia Di Giorgio 2023년 3월 9일
댓글: Giulia Di Giorgio 2023년 3월 9일
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
Giulia Di Giorgio 2023년 3월 9일
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.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Map Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by