Filter löschen
Filter löschen

Update simulink block parameters on xPC target

5 Ansichten (letzte 30 Tage)
Nick
Nick am 3 Apr. 2014
Kommentiert: ABISHA P am 11 Jan. 2017
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.

Antworten (2)

Rajiv Ghosh-Roy
Rajiv Ghosh-Roy am 3 Apr. 2014
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 am 3 Apr. 2014
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 Kommentare
Rajiv Ghosh-Roy
Rajiv Ghosh-Roy am 7 Apr. 2014
Bearbeitet: Rajiv Ghosh-Roy am 7 Apr. 2014
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 am 11 Jan. 2017
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?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Multicore Processor Targets finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by