How to saturate a variable according to my range in RTW embedded coder
Ältere Kommentare anzeigen
Hi, I 'm generating an Auto code using an RTW embedded coder. I'm facing staturation issue when i tested the code. problem is saturating my variable according to my range of that variable is not taking, it takes as per the datatype of variable.
For ex: input variable name : abc
range : [0..255]
datatype: uint8
output variable name: out
range: [0..254]
datatype: uint8
implementation in model is out = abc + 1
generated code for this add block will be like
tmp = abc + 1 ;
if(tmp >255)
{
out = 255;
}else{
out = tmp;
}
Now out variable range will be limited to 255 but i need it till 254
How to set the staturation with my range for an output variable.
please help me!!!
Thanks and Regards, Nithin
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Deployment, Integration, and Supported Hardware finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!