필터 지우기
필터 지우기

How to handle logical arrays in Simulink?

조회 수: 4 (최근 30일)
Utku
Utku 2023년 12월 20일
댓글: Sulaymon Eshkabilov 2023년 12월 20일
I have a logical comparison of an array in Simulink. I need to use any() function in MATLAB to handle the output of the comparison but I realized there is not any representation of this function in Simulink library. Is using MATLAB Function block the only way to use any() or all() functions in Simulink? Is there any particular reason that these do not exist in Simulink library? How do you handle logical arrays in Simulink?
  댓글 수: 1
Utku
Utku 2023년 12월 20일
To be more specific, for example, I do the logical operation "[1 2 3 4 5] == 2" in Simulink, and the output is a logical array which is [0 1 0 0 0], but I need a single output as 1 in this case.

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

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 20일
Yes, it can be worked around - see this plain model:
  댓글 수: 2
Utku
Utku 2023년 12월 20일
Thank you very much! I gues this is the only proper way other than using MATLAB function
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 20일
Most welcome! Glad to be of some help.

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

추가 답변 (2개)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 20일
Of course Simulink blocks can be used. Simulink library has a bunch of logic operation blocks - follow to see them: Simulink -> Logic and Bit Operations.

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023년 12월 20일
See this screenshot:
  댓글 수: 1
Utku
Utku 2023년 12월 20일
Thank you for your answer, but I need a single output from an array comparison. All of these do not do the same job that any() function does in MATLAB.

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

카테고리

Help CenterFile Exchange에서 Simulink Functions에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by