필터 지우기
필터 지우기

What's the best way to write this code?

조회 수: 3 (최근 30일)
which doctor?
which doctor? 2023년 12월 5일
댓글: which doctor? 2023년 12월 6일
I'm doing some coursework on an aircraft fuel system controlled in simulink/matlab and I'm pretty new to Matlab.
Basically the conditions for this operation are that there needs to be either a main pump or aux pump running to feed fuel into each engine, of which there are two.
Is it possible to express this as (OR)(AND)(OR) like what I'm trying to do here and how would I write it?
while ((RFeedPump1Stat == 1) "OR" (RFeedPump2Stat == 1)) && ((LFeedPump1Stat == 1) "OR" (LFeedPump2Stat == 1))
if (XFeedSwitch == 1)
XFOpen = 1;
REOpen = 0;
elseif (XFeedSwitch == 2)
XFOpen = 1;
LEOpen = 0;
else
XFOpen = 0;
end
end
thank you.

채택된 답변

madhan ravi
madhan ravi 2023년 12월 5일
"OR" to be replaced with ||
  댓글 수: 3
madhan ravi
madhan ravi 2023년 12월 5일
Change your code from this
while ((RFeedPump1Stat == 1) "OR" (RFeedPump2Stat == 1)) && ((LFeedPump1Stat == 1) "OR" (LFeedPump2Stat == 1))
To this
while ((RFeedPump1Stat == 1) || (RFeedPump2Stat == 1)) && ((LFeedPump1Stat == 1) || (LFeedPump2Stat == 1))
which doctor?
which doctor? 2023년 12월 6일
thanks!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Electrical Block Libraries에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by