MATLAB: Is it possible to calculate and hold a value constant during the Simulink calculation

constant valuesimulink

Is it possible to calculate a value somewhere during a simulink simulation and use it from that point on as a constant in a calculation. I would use this in a IF action subsystem (or maybe While or For loop) where at a certain condition a value should be calculated and from that point on used in a calculation as a constant.

Best Answer

Put the calculation inside a triggered subsystem and make the output of the system the desired calculated value. Trigger the subsystem when you want to calculate the value.
Related Question