フィルターのクリア

MATLAB Function Block - output cannot change

4 ビュー (過去 30 日間)
Lau Boon Chong
Lau Boon Chong 2019 年 12 月 22 日
コメント済み: Walter Roberson 2019 年 12 月 23 日
Hi All
I am trying to generate different output by using MATLAB Function Block. Below is my code, simulink model and output measure by scope.
function duty = fcn()
duty = 0.5;
pause(1);
duty = 0.1;
pause(1);
end
simulink model.jpg
scope.jpg
However, the output of the function block always come from the last value. Anything wrong about my code?
  3 件のコメント
Lau Boon Chong
Lau Boon Chong 2019 年 12 月 23 日
Hi, thank for your reply. Actually I am trying to write an algorithm for my simulink model. I am thinking to use MATLAB block to implement it. The above example is just my experiment. My algorithm have to real time read different data from excel files and generate corresponding different outputs. Anyway suggestion from you how to implement it? Thank you.
Walter Roberson
Walter Roberson 2019 年 12 月 23 日
In Simulink, a MATLAB Function Block can emit outputs only when it returns. The outputs returned can potentially be vectors or arrays, and are not necessarily fixed size.
However, if you return N output values from a single Function Block invocation, how do you want those treated in time? Do you want to queue those N values in a bunch, and release one value per time-step? Do you want to process all N of the values in a group in the same time step? Do you want a series of blocks to suddenly run N times faster so that at the end of the time step for the Function Block, all N of the outputs have been processed one at a time?

サインインしてコメントする。

回答 (0 件)

カテゴリ

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

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by