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

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

Accepted Answer

Xiaoning.Wang
Xiaoning.Wang on 19 Nov 2023
  2 Comments
Xiaoning.Wang
Xiaoning.Wang on 25 Oct 2024
set_param(gcbh,'AttributesFormatString',[val,char(13,10)',valstr]); 表示换行
运行结果如下:
>> [val,char(13,10)',valstr]
ans =
cVcScFeh_B_DCDCUnavailTest
0
注意:char(13,10)',
Xiaoning.Wang
Xiaoning.Wang on 25 Oct 2024
如果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]);

Sign in to comment.

More Answers (0)

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!