【MBD】Simulink常用脚本
*添加模块,参数为:所用模块、模型名/模块名、位置大小*2
add_block('simulink/Commonly Used Blocks/Out1','untitled/myname','Position',[x1,y,x1+w,y+h]);
*添加线
add_line('untitled','CAN_ESCL_Lock_Inhibit_In/1','CAN_ESCL_Lock_Inhibit_Out/1');
*查找某个模块,参数为:模型名、查找层数=1、模型类型=Inport、模型名字
find_system('IBC_APP','SearchDepth',1,'BlockType','Inport','Name','myname')
*获取句柄:添加'FindAll','on'参数
h=get(find_system('IBC_APP','SearchDepth',1,'FindAll','on','BlockType','Inport','Name','LIN_Brightness_PD_0x14'))
*设置属性 参数:句柄,属性,参数
set(a,'Name','test')