Main Content

delete_block

Delete blocks from Simulink system

Description

example

delete_block(blockArg) deletes the specified blocks from a system. Open the system before you delete blocks.

Examples

collapse all

Delete the block Mu from the vdp system.

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 = 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])

Input Arguments

collapse all

Blocks to delete, specified as the full block path name, a handle, a vector of handles, or a 1-D cell array or string array of handles or block path names.

Example: 'vdp/Mu'

Example: [handle1 handle2]

Example: {'vdp/Mu' 'vdp/Out1' 'vdp/Out2'}

Example: "vdp/Out"+(1:2)

Version History

Introduced before R2006a

See Also