Error using / Matrix dimensions must agree app designer

Hi , i have code, that works perfectly in script , but when i try to run it in app designer i got error. On 1st line i got this :
Matrix dimensions must agree.
and i guess it will be on every line.
app.q1 = real(acosd(app.d4/sqrt(app.AA^2+app.BB^2))+atan2d(app.BB,app.AA)+90);
app.q5 = real(acosd((app.px*sind(app.q1)-app.py*cosd(app.q1)-app.d4)/app.d6));
app.CC = cosd(app.q1)*app.r22-sind(app.q1)*app.r12;
app.DD = sind(app.q1)*app.r11-cosd(app.q1)*app.r21;
app.q6 = real(atan2d(app.CC/sind(app.q5),app.DD/sind(app.q5)));
app.EE = cosd(app.q1)*app.r11+sind(app.q1)*app.r21;
app.FF = cosd(app.q5)*cosd(app.q6);
q234 = real(atan2d(app.r31*app.FF-sind(app.q6)*app.EE,app.FF*app.EE+sind(app.q6)*app.r31));
app.KC = cosd(app.q1)*app.px+sind(app.q1)*app.py-sind(q234)*app.d5+cosd(q234)*sind(app.q5)*app.d6;
app.KS = app.pz-app.d1+cosd(q234)*app.d5+sind(q234)*sind(app.q5)*app.d6;
c3 = (app.KS^2+app.KC^2-app.a2^2-app.a3^2)/(2*app.a2*app.a3);
s3 = sqrt(1-c3^2);
app.q3 = real(atan2d(s3,c3));
app.q2 = real(atan2d(app.KS,app.KC)-atan2d(sind(app.q3)*app.a3,cosd(app.q3)*app.a3+app.a2));
app.q4 = q234-app.q2-app.q3;
app.theta(1,:) = [app.q1 app.q2 app.q3 app.q4 app.q5 app.q6];

 采纳的回答

5 个评论

I have already tried and then i get this
Unable to perform assignment because the indices on the left side are not compatible with the size of the right
side.
on the last line. I have 8 types of this calculation and at the end result is matrix 8*6.
We don't know the sizes of the arrays involved - so how should we be able to tell you what's going wrong ?
There are 8 types of couting, results are q1 q2 q3 q4 q5 q6. They are stored array under. After all 8 countings are done, i got matrix 8x6. There are no any more arrays.
app.theta(1,:) = [app.q1 app.q2 app.q3 app.q4 app.q5 app.q6];
.
.
.
app.theta(8,:) = [app.q1 app.q2 app.q3 app.q4 app.q5 app.q6];
I have solved it , but thanks for help anyway
Glad you got it fixed.
Since using ./ instead of / fixed the error you asked about, please Accept this answer. Thanks!

请先登录,再进行评论。

更多回答(0 个)

类别

帮助中心File Exchange 中查找有关 Mathematics 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by