how to Call back API calls the value of Constant Block 如何使用Call back API 调用Constant Block的值

I have set a variable in the Constant block and want to view its definition through the call back method
在Constant block中设置了变量, 想通过call back的方式查看该变量的定义

 Akzeptierte Antwort

Xiaoning.Wang
Xiaoning.Wang am 19 Nov. 2023

2 Kommentare

set_param(gcbh,'AttributesFormatString',[val,char(13,10)',valstr]); 表示换行
运行结果如下:
>> [val,char(13,10)',valstr]
ans =
cVcScFeh_B_DCDCUnavailTest
0
注意:char(13,10)',
如果Constant 不是单单的一个值,而是其他公司定义的标定量,则
val=get_param(gcbh,'Value');
%valstr=num2str(evalin('base',val));
valstr=num2str(eval([val,'.Value'])); %标定量的Value
%set_param(gcbh,'AttributesFormatString',[val,'=',valstr]);
set_param(gcbh,'AttributesFormatString',[val,char(13,10)',valstr]);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink 快速入门 finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!