How to solve: Output 'mylength' (#194) has variable size but the upper bound is not specified; explicit upper bound must be provided.
Ältere Kommentare anzeigen
Hi,
I am working on a simulink model using dynamic formula creation. In order to do so, I have the following subsystem, which is not working properly. I would like to divide a body into smaller parts of different length, mass and moment of inertia. So I thought about using matrizes with each element corresponding to a different part of the body.
function [mylength,I,massjoints] = initialise(length1A,length2A,width1A,N,mass)
mylength=zeros(N,1);
massjoints=zeros(N,1);
I=zeros(N,1);
split=round(N*0.68);
for i=1:split
mylength(i,1)=(length1A/(N*0.68));
massjoints(i,1)=((mass*0.68)/split);
end
for i=(split+1):N
mylength(i,1)=(length2A/(N*0.32));
massjoints(i,1)=((mass*0.32)/(N-split));
end
for i=1:N
I(i,1)=((massjoints(i,1)/12)*((mylength(i,1)^2)+width1A^2));
end
<<< The input variables are all integer numbers.
I got the error message #87 at first, stating that the matrix "mylength" is of variable-size but otherwise specified. Then I ticked the variable-size button in model explorer. I gave different values for the upper bound (integer numbers, matrizes and the input "N") none of these worked and gave me the error in the title.
Do you know how to work around that problem?
Many Thanks, Christian
1 Kommentar
Christian
am 18 Nov. 2014
Antworten (1)
Shreeya
am 8 Okt. 2024
0 Stimmen
Hello
If the size of a variable can change during model simulation, setting the sizes in the Data Editor for the MATLAB Function Block is required. Refer to the below documentation for more information on this:
Also, if the variable size does not change during simulation, it's "tunable" property should be set to off.
Refer to the below MATLAB answers link to understand more about both the scenarios:
Kategorien
Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!