之前介绍过get_tlcg_data, set_tlcg_data, dsdd之SelectObject,今日就使用一个简单的例子来,结合这三个函数来实现修改block的变量标定。
1.建立GUI在建立GUI之前,如果还不会怎么建立GUI的话,执行脑补一下。
新建GUI添加按钮2.设置回调函数设置Variable的回调函数 callback
12345678910111213% --- Executes on button press in tl_variable.function tl_variable_Callback(hObject, eventdata, handles)% hObject handle to tl_variable (see GCBO)% eventdata reserved - to be defined in a future version of MATLAB% handles structure with handles and user data (see GUIDATA)tlcg_data = get_tlcg_data(gcbh);output = tlcg_data.output;[currentPath,bModified] = dsdd('SelectObject','CurrentPath',output.variable ,'objectKind','Variable');if bModified == 1 output.variable = currentPath; tlcg_data.output = output; set_tlcg_data(gcbh, tlcg_data);end3.结果演示选中一个Block,此处选中了Gain模块 点击Variable按钮 #### 选中变量 #### 确定查看效果