Create Array in Simulink

Hello
I want to create an array in Simulink based on two constants. Like using "linspace(1,1,10)" in Matlab, but from two constant blocks of magnitude "1" and "10".
Thanks in Advance

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 9 日

0 投票

2 件のコメント

David C
David C 2015 年 8 月 9 日
I tried, but I can't write:
function y = fcn(u)
y=linspace(1,u,u)
end;
"u" is not a parameter input, it is a constant input, that can vary.
Thanks
Azzi Abdelmalek
Azzi Abdelmalek 2015 年 8 月 10 日
function y = fcn(u)
%#codegen
coder.extrinsic('linspace')
y = coder.nullcopy(zeros(1,numel(u)));
y =linspace(1,u, u)
Don't forget to declare the output y (type edit data in the editor of your function) as variable size.

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

カテゴリ

ヘルプ センター および File ExchangeSimulink Functions についてさらに検索

タグ

質問済み:

2015 年 8 月 9 日

コメント済み:

2015 年 8 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by