フィルターのクリア

How to have variable-sized output for Simulink MATLAB-function block?

18 ビュー (過去 30 日間)
Arun
Arun 2013 年 7 月 22 日
I have a MATLAB function-block in Simulink and I would like to have the output port of the block dynamically sized based on an input parameter. Eg:
function[y] = MATLABblock(u, s)
y = someCalc(u,s) %%Returns array of size s %%
Is this possible?

採用された回答

Kaustubha Govind
Kaustubha Govind 2013 年 7 月 22 日
I think this should work as long as you can enforce a maximum size for y. Simulink currently does not support dynamic memory allocation, so you must specify a maximum-size for variable-size signals. Please see the section on Variable-Size Data in the documentation to ensure that your output is configured as variable-size.
  2 件のコメント
Arun
Arun 2013 年 7 月 23 日
Hi! Thank you for your response. I have got it to work. However, is there a restriction on how many such ports in a block can be variable-sized? The reason is, I have 8 identical ports with identical Port Settings (variable size with an upper bound of 1024), but only one of them works.
Arun
Arun 2013 年 7 月 23 日
Sorry about the above comment. It was a bug in my code. I have corrected that and now it's all good. Thank you very much for your help!

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by