Reputation: 35
I need to set simulation stop time into a variable in the same simulation; in a gain block I have a variable t
that actually is the simulation time and I want it to be set automatically, even I change every time simulation stop time.
Upvotes: 1
Views: 4768
Reputation: 1343
Put these in project InitFcn
callback;
stop_time_as_str = get_param(gcs, 'StopTime');
t= str2double(stop_time_as_str);
like this:
Right click on the white spot in project window -> select Model properties -> callbacks -> InitFcn
Upvotes: 2