MATLAB: How to create the own parameters or attributes for a block in simulink

MATLABMATLAB Compilersimulink

In this case I am trying to create a new block parameter as a new property to save a specific new data which I don't want to be saved in a defalut parameter which is already reserved for other diffrent related datas
for this parameter I want to use the command get_param and set_para that need to be alreday existed

Best Answer

Option 1: Use the 'UserData' of the block to specify your own properties:
vdp;
UD.prop1=1;
UD.prop2='abc';
set_param('vdp/Mu','UserData',UD,'UserDataPersistent','On');
MyData=get_param('vdp/Mu','UserData');
MyData.prop1
MyData.prop2
Option 2: Use Mask. You can add any parameters to any block through Mask. But it might alter the diaglog of the block.