variable size of simulink matlab function

29 vues (au cours des 30 derniers jours)
Syed hamza Ali Tirmizi
Syed hamza Ali Tirmizi le 4 Avr 2018
function desired = path_planning(data_points,slope0,slopeF,dt)
t_dummy=0:((length(data_points))-1);
tq=0:(dt/10):((length(data_points))-1);
desired=spline(t_dummy,[slope0; data_points; slopeF],tq);
end
error "Data 'desired' is inferred as a variable size matrix, while its properties in the Model Explorer specify its size as inherited or fixed. Please check the 'Variable Size' check box and specify the upper bounds in the size field."
i am also attaching the simulink file, can you please see what is issue here? the same function works fine in matlab but not in simulink.

Réponse acceptée

Birdman
Birdman le 4 Avr 2018
Run the attached model. What you basically needed to do is to go to Model Explorer and set the output of the MATLAB Function as variable size by checking the tickbox there. Also, specify the size of the output.
  16 commentaires
Birdman
Birdman le 4 Avr 2018
hamza's answer moved here:
thanks Birdman, i got a solution from this discussion. i first need to define var size where you asked me to. So it outputs the correct results.
Birdman
Birdman le 4 Avr 2018
You are welcome. Actually, there was nothing else I could suggest because it should have worked with the way that I suggested. Anyway, I am glad it works.

Connectez-vous pour commenter.

Plus de réponses (1)

Lavanya Dachepally
Lavanya Dachepally le 17 Juil 2019
The same question but in my case I need to check that variable size and specify its size through commands.
I have connected to the function block to the model through commands and the output of the function comes into picture when I ran code which is of variable based on the input.
Please can some one help how to check the box and specify its size through some commands.

Catégories

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

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by