How to clear this Error :In an assignment A(I) = B, the number of elements in B and I must be the same
Info
This question is closed. Reopen it to edit or answer.
Show older comments
In the below hexagon figure, the parallelogram of coordinate (g,h) is the base plane on which I am working on.
In this plane (g,h) is the reference plane & input of the coding. By this simple logic, if reference coordinates is fed in to the system, all the four coordinates will be found/calculated & that is the idea of the s function code. For an example: If (g,h) is (1.15,0.69) then the four coordinate points
(m1,n1)=(1,0)
(m2,n1)=(2,0)
(m1,n2)=(1,1)
(m2,n2)=(2,2)
will be found & that's the idea.
Attached is a picture of the error, model file & parallelogram inside hexagon.
Guidance/help to eradicate this problem are most welcome.
My S function program:
<<

>>
function sys = mdlOutputs(t,x,u)
g=u(1);
h=u(2);
global m;
global n;
global m1;
global m2;
global n1;
global n2;
m=0;
while (g<m)
m1=(m-1);
m2=m;
if (g>m)
m=m+1;
end
end
n=0;
while (h<n)
n1=(n-1);
n2=n;
if (h>n)
n=n+1;
end
end
M1=m1;
M2=m2;
N1=n1;
N2=n2;
sal(1)=M1;
sal(2)=M2;
sal(3)=N1;
sal(4)=N2;
sys=sal;
% End of mdlOutputs.

8 Comments
Image Analyst
on 29 Dec 2013
How are you calling mdlOutputs()? What are you passing in for t, x, and u?
Kaustubha Govind
on 30 Dec 2013
I'd recommend setting a breakpoint in the mdlOutputs function and stepping through it to find the cause of the error.
Kaustubha Govind
on 30 Dec 2013
Charanraj: Please be considerate and avoid sending personal messages to contributors on this forum. All users participate voluntarily, and in their spare time. To continue the discussion, post as a comment, instead of sending personal messages.
Charanraj
on 30 Dec 2013
Charanraj
on 1 Jan 2014
Answers (0)
This question is closed.
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!