Create Array in Simulink

5 vues (au cours des 30 derniers jours)
David C
David C le 9 Août 2015
Commenté : Azzi Abdelmalek le 10 Août 2015
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

Réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 9 Août 2015
  2 commentaires
David C
David C le 9 Août 2015
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 le 10 Août 2015
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.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Event Functions dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by