limit an attribute value to a specified maximum

bibo59
bibo59 New Altair Community Member
edited November 2024 in Community Q&A

Hello,
how to limit an attribute (numerical) value to a specified maximum ?
If my attribute = 1.5 then my attribute = 1  
Thanks

Tagged:

Best Answer

  • MartinLiebig
    MartinLiebig
    Altair Employee
    Answer ✓

    Hi,

     

    you can use Generate Attributes for this. Something like

     

    if(attribute=1.5,1,attribute)

     

    should do it.

     

    Best,

    Martin

Answers

  • MartinLiebig
    MartinLiebig
    Altair Employee
    Answer ✓

    Hi,

     

    you can use Generate Attributes for this. Something like

     

    if(attribute=1.5,1,attribute)

     

    should do it.

     

    Best,

    Martin

  • bibo59
    bibo59 New Altair Community Member

    Thank you very much

  • Telcontar120
    Telcontar120 New Altair Community Member

    @bibo59 You might consider making your expression a bit more flexible.  Martin's solution works if the higher value is exactly 1.5, but not for other values.  So instead you could use an if statement like this: if(attribute>1,1,attribute).

    Or you could directly use the MIN function like this: min(1,attribute).