>> get_param('rtpacketio/Constant', 'DialogParameters')
ans =
Value: [1x1 struct] <<< This is the one you need to change
VectorParams1D: [1x1 struct]
SamplingMode: [1x1 struct]
OutMin: [1x1 struct]
OutMax: [1x1 struct]
OutDataTypeStr: [1x1 struct]
LockScale: [1x1 struct]
SampleTime: [1x1 struct]
FramePeriod: [1x1 struct]
请注意,这些参数的值不是 struct s - 从 DialogParameters 参数返回的struct数组表示有关参数的信息;当你设置或获得一个块's parameter it must be a string (because it'进入 edit 控件时) . 在要设置此参数的代码中,您可以执行以下操作:
1 回答
只要您知道块的"path",就可以使用set_param和get_param设置/获取其参数 . 在您的情况下,第一个常量块具有路径
'rtpacketio/Constant'
- 即系统名称后跟/
,后跟块的名称 .要找出可用于块的参数,您可以这样做,
请注意,这些参数的值不是
struct
s - 从DialogParameters
参数返回的struct数组表示有关参数的信息;当你设置或获得一个块's parameter it must be a string (because it'进入edit
控件时) . 在要设置此参数的代码中,您可以执行以下操作:如果您需要高精度,您可能希望用更准确的等效替换
num2str
.