Function block in simulink

3 ビュー (過去 30 日間)
Mikkel
Mikkel 2015 年 4 月 1 日
コメント済み: Sebastian Castro 2015 年 4 月 1 日
Hi
IN SHORT:
I need to run the same matlab code several places in a simulink simulation. I have op to ~100 different input variables on the code(some bounded in vectors), but I would like not to MUX it all to gether to use the Interpreted MATLAB Function.
Is there another way to share the code between multiple blocks in simulink?
IN LONG:
I'm creating a system where I have two vessels that are suppose to move according to the same set of functions, I need to run them simultaneously, and NOT from the same block. Right now I'm using the Matlab Function Block, but copying the code from one block to another for every test and change is a hassle. All my block have several different inputs, some vectors with up to 20 elements. to MUX this into one vector would give me input vectors with more the ~100 elements, This would enable me to use the Interpreted MATLAB Function.
But are there a way where I can keep my inputs in the vectors that I have and still share the same code between multiple matlab blocks?

回答 (1 件)

Sebastian Castro
Sebastian Castro 2015 年 4 月 1 日
Hi Mikkel,
I think the best bet would be to place that MATLAB Function block in a Simulink library. Then, each instance of the block can be sourced from the same library block.
- Sebastian
  2 件のコメント
Mikkel
Mikkel 2015 年 4 月 1 日
So like a custom block? Would it then be possible to change the code in one place only? Do you know of a small guide to do that?
Sebastian Castro
Sebastian Castro 2015 年 4 月 1 日
Yes, you would change it only in the library file itself. That is the single source.

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

カテゴリ

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

製品

Community Treasure Hunt

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

Start Hunting!

Translated by