%% Open Loop simulation and save the final state steady_time = 10; initializeSimConf(struct('Tsim', steady_time, 'cl_time', steady_time)); set_param('sim_nano_station_ctrl',... 'SaveFinalState','on',... 'FinalStateName','myOperPoint',... 'SaveCompleteFinalSimState','on'... ); sim('sim_nano_station_ctrl'); save('./data/myOperPoint.mat', 'myOperPoint'); set_param('sim_nano_station_ctrl',... 'SaveFinalState','off',... 'SaveCompleteFinalSimState','off'... ); save('./data/exp_open_loop.mat', 'Dmeas'); %% Close the Loop and start from steady state sim_time = 10; initializeSimConf(struct('Tsim', steady_time+sim_time, 'cl_time', steady_time)); load('./data/myOperPoint.mat', 'myOperPoint'); set_param('sim_nano_station_ctrl',... 'LoadInitialState','on',... 'InitialState','myOperPoint'... ); sim('sim_nano_station_ctrl'); set_param('sim_nano_station_ctrl',... 'LoadInitialState','off' ... ); save('./data/exp_close_loop_xyz.mat', 'Dmeas');