Hi shi,
I see that you want to call the "function()" in a state. In other words, "Out1" of the "function()" should be usable in a state.
To achieve this, "Out1" can simply be passed as an input to the "Chart". This makes sure that at every time step, "function()" runs and "Out1" is available in all states.
Consider the following example:
In this “Chart”, assume that the “constant” block is the “Out1” of “function()”. In the state, simply use the “data” which is the input signal as follows:
Following is the output when it is run:
Hope this helps!