フィルターのクリア

%<BaseSampleTime> variable not available in simulink model-tlc file?

1 回表示 (過去 30 日間)
Sietse
Sietse 2015 年 6 月 9 日
回答済み: Drew Davis 2015 年 6 月 10 日
I am trying to create a simulink block that should depend on the base-sample-rate of the model. I tried to put the following in the model-block-tlc file:
%if %<BaseSampleTime> > 0.003
adc1_sum = 0;
for (int i=0; i<8; i++ ) {
adc1_sum += Get_ADC_Value(11);
}
%else
adc1_sum= Get_ADC_Value(11)*8;
%endif
But I get: Undefined identifier BaseSampleTime
Is there a way to determine this value in the models tlc-file? (apart from creating a variable when this value is in scope?)
Thanks in advance, Sietse

採用された回答

Drew Davis
Drew Davis 2015 年 6 月 10 日
I do not know of any TLC function to get the base sample time of the model. There is however a list of TLC sample time functions that you may find useful. For instance, the function 'LibBlockSampleTime(block)' allows you to access the sample time of the block.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTarget Language Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by