フィルターのクリア

Set Powergui sample time in m-File

10 ビュー (過去 30 日間)
Flo
Flo 2016 年 11 月 4 日
回答済み: Kushagr Gupta 2016 年 11 月 8 日
Hello,
i want to set the powergui sampling time over matlab in a .m Script. Unfortunately i found nothing in the help or on google. Has anyone an idea?
Regards, Florian

回答 (1 件)

Kushagr Gupta
Kushagr Gupta 2016 年 11 月 8 日
I understand that you want to programmatically modify the sample time of the POWERGUI block in a simulink model.
It is definitely possible to do so and here is one way in which it can be done:
  1. Get access to the POWERGUI block (path-address of the block). This can be found by highlighting the block and executing the 'gcb' command on the prompt. Store output of gcb in a variable
  2. Use the command 'set_param' to modify the 'SampleTime' property of POWERGUI block.
Following code snippet explains how it can be done:
>> PowerGuiBlk = gcb % after selecting the block in model if address not known, else can store the address as a string in the variable
>> set_param(PowerGuiBlk,'SampleTime','0.1') % The third argument needs to given as a string containing a number which modifies the SampleTime to be 0.1s.
Note : 'set_param' can be used to modify various properties of a block and 'get_param' can be used to find block properties. For example:
>> get_param(PowerGuiBlk,'DialogParameters') % returns Dialog Box values of the PowerGui Block
Hope this helps!

カテゴリ

Help Center および File ExchangeEvent Functions についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by