Update simulink block parameters on xPC target

1 次查看(过去 30 天)
I would like to update the paramters in a compiled simulink model running on a xPC target. I am able to set most parameters though the (target handle).set_param(XX, XX) function. However, I do not know how to set block parameters like for instance, the sample time of a digital clock or the number of samples to hold in a buffer, on the compiled instance of the model. Is it possible to set these parameters without having to recompile each time, and if so how?
Many thanks Nick G.

回答(2 个)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy 2014-4-3
Certain parameters are not tunable. From the examples you gave, it appears that these are not. For instance, for the number of samples in a buffer, this would determine the size of the buffer: this would be built into the code and does require a rebuild.

Nick
Nick 2014-4-3
Thanks Rajiv, so then as a follow up can you tell me how I could programatically set the buffer size in a script?
Thanks, Nick
  2 个评论
Rajiv Ghosh-Roy
Rajiv Ghosh-Roy 2014-4-7
编辑:Rajiv Ghosh-Roy 2014-4-7
This is slightly more involved as you will need to find the name of the particular parameter. Using the Integrator block as an example,
>> get_param(gcb, 'DialogParameters')
ans =
ExternalReset: [1x1 struct]
InitialConditionSource: [1x1 struct]
InitialCondition: [1x1 struct]
LimitOutput: [1x1 struct]
UpperSaturationLimit: [1x1 struct]
LowerSaturationLimit: [1x1 struct]
ShowSaturationPort: [1x1 struct]
ShowStatePort: [1x1 struct]
AbsoluteTolerance: [1x1 struct]
IgnoreLimit: [1x1 struct]
ZeroCross: [1x1 struct]
ContinuousStateAttributes: [1x1 struct]
I can then guess that InitialCondition is the parameter I want to use. I can verify that this is the case by executing get_param(gcb, 'InitialCondition'), and checking the value. At this point, I can execute set_param(gcb, 'InitialCondition', '6'). Note that you must set the value as a string.
Of course, you will need to this with the block you want to use and find the actual parameter name.
See the help for get_param and set_param
ABISHA  P
ABISHA P 2017-1-11
how to call .m file in simulink model for performing filtering operations like sliding window , savtzky golay filter , spectrogram generation, these operations are done in m file same thing has to be called in simulink ? How can i do it?

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by