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 CenterFile Exchange에서 Sources에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by