How to use integer or other datatype condition in if Block, Simulink?

조회 수: 4 (최근 30일)
Tejas
Tejas 2024년 3월 22일
댓글: Tejas 2024년 3월 27일
Hello,
I want to use condition like if (u ==1), IF block has single/double data type by default, so whenever I generate the code from simulink model, this condition shows u == 1.0F How can I change data type to Int or Boolean so in the autocode it will show u == 1.0 ??
Or any other way to implement if elseif condition where I could change the data type of if condition in Simulink?
Thanks in advance for your answer.

채택된 답변

Fangjun Jiang
Fangjun Jiang 2024년 3월 24일
Try this, Use a Relational Operator block where you can specify any data type for the inputs. Specify the output data type as boolean which is the default. Feed this to the IF block where the condition is if (u)
  댓글 수: 12
Fangjun Jiang
Fangjun Jiang 2024년 3월 27일
Update:
I reported the incorrect documentation to the Mathworks tech support. I have been notified that an update/correction of the document will be coming soon.
Tejas
Tejas 2024년 3월 27일
That's great, thanks for the update.

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

추가 답변 (0개)

카테고리

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

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by