フィルターのクリア

Load timeseries from Python into Simulink

7 ビュー (過去 30 日間)
Moshe Kravchik
Moshe Kravchik 2020 年 8 月 3 日
回答済み: Raunak Gupta 2020 年 8 月 8 日
Hi,
I have never programmed Simulink before and have done very little MATLAB. So please excuse me if it is really simple question.
I have a simulation where I want to alternate one of the signals in the code. The change is time-dependent and I calculate it in my Python code.
I added a user-defined function so I can do the modification, but can't figure out how to load the values i calculated in Python.
I know that my function is called every 0.0001th of an hour and have converted my Python array to the corresponding values. But how do I synchronize them? I tried converting the array to timeseries but it looks that the granularity is 1 second and this is not what I need.
Please advice,
Moshe

採用された回答

Raunak Gupta
Raunak Gupta 2020 年 8 月 8 日
Hi,
The timeseries by default, will create the time indexes in order of 1 seconds. You can mention the time values in a vector in timevals option. This way the data will be corresponding to correct time instances.
For example, your data vector is data with size (1x100). So, the timevals can be defined as
% timeValues represent in seconds instead of hours because in simulink seconds is used widely
timeValues = 0:(0.0001*3600):(0.0001*3600*99);
timeSeriesfinal = timeseries(data,timeValues);

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by