Abs in stateflow chart

조회 수: 15 (최근 30일)
David Jose
David Jose 2018년 5월 8일
답변: Yoke Peng Leong 2018년 5월 17일
In stateflow transition label, am using abs command to do the math. example:Transition [(abs(a)> abs(b))], While doing the code generation using Embedded coder,in the auto generated C file 'abs' is replaced with a Conditional operator statement example: (a>0? -a: a ). I want to retain the 'abs' term in the code so that readability will be good.

답변 (1개)

Yoke Peng Leong
Yoke Peng Leong 2018년 5월 17일
Currently, there is no straight forward way of doing that.
An option is to use coder.ceval('abs',a) in Stateflow in order to force the code generation to use abs.
I have forwarded this feedback to the relevant team in MathWorks.

카테고리

Help CenterFile Exchange에서 Decision Logic에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by