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.
0 个评论
回答(2 个)
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.
0 个评论
Nick
2014-4-3
2 个评论
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
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 Exchange 中查找有关 Sources 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!