Delete blocks from Simulink system
delete_block(blockArg)
example
delete_block(blockArg) deletes the specified blocks from a system. Open the system before you delete blocks.
blockArg
collapse all
Delete the block Mu from the vdp system.
vdp
open_system('vdp') delete_block('vdp/Mu')
Delete the block Out2 from the vdp system using the block handle.
Open the vdp system.
open_system('vdp')
Interactively select the block Out1. Get the block’s handle and assign it to the variable Out1_handle. Delete the block using the handle.
Out1_handle
Out1_handle = get_param(gcb,'Handle'); delete_block(Out1_handle)
Delete three blocks from the vdp system.
Open the vdp system. Add three blocks and assign their handles to variables.
open_system('vdp') Constant_handle = add_block('built-in/Constant','vdp/MyConstant'); Gain_handle = add_block('built-in/Gain','vdp/MyGain'); Outport_handle = add_block('built-in/Outport','vdp/MyOutport');
Delete the blocks you added using a vector of handles.
delete_block([Constant_handle Gain_handle Outport_handle])
Blocks to delete, specified as the full block path name, a handle, a vector of handles, or a 1-D cell array of handles or block path names.
Example: 'vdp/Mu'
'vdp/Mu'
Example: [handle1 handle2]
[handle1 handle2]
Example: {'vdp/Mu' 'vdp/Out1' 'vdp/Out2'}
{'vdp/Mu' 'vdp/Out1' 'vdp/Out2'}
add_block