Simulink- user define function - matlab funciton:Size of function not bounded error

7 vues (au cours des 30 derniers jours)
Haijia Zhu
Haijia Zhu le 8 Juin 2016
Modifié(e) : Haijia Zhu le 8 Juin 2016
I met a problem similar as (<http://www.mathworks.com/matlabcentral/newsreader/view_thread/310599),however>, things as little different.
Here is my problem: I create a matlab function in simulink and while i run this model, this block can't not works well: the error is as shown below:
Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?].
I follow the instruction and added the upper bound, however, it still not working. I take a look at the report, and find the variable is actually bounded: see pic below
actually, all the variable is bounded.
My code is as shown below:
step_w = (ub-lb)/1000;
coder.varsize('trq_all',[1 1001],[0,1]);
% trq_all = zeros(1,1001)
trq_all = [lb:step_w:ub];
ub is upper bound, lb is lower bound.
Thanks.

Réponses (0)

Catégories

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

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by