Update simulink block parameters on xPC target

1 回表示 (過去 30 日間)
Nick
Nick 2014 年 4 月 3 日
コメント済み: ABISHA P 2017 年 1 月 11 日
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 Center および File ExchangeSources についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by