When I use the following command in the StopFcn callback of the attached model example.mdl
delete_block('example/Gain')
I receive the following error:
Error evaluating 'StopFcn' callback of block_diagram 'example'. Error using ==> delete_block Cannot delete 'example/Gain' while simulation is running.
I would like to have the option of deleting blocks in the StopFcn callback of a model in SIMULINK.
Best Answer