Can you help me about this problem?

i don't understand error related vercat .

Answers (3)

dpb
dpb on 17 Dec 2014
More than likely you've tried to append a row and a column vector. Either way, a vertical concatenation must have the same number of columns in all entities being concatenated, similarly horizontal concatenation requires equal number of rows.
Try size on the arguments in the line in question to see who's who and all will likely become clear.
Burak
Burak on 17 Dec 2014
Edited: dpb on 17 Dec 2014
D = [-1 0 1 0 0 0 0 0 0;
0 -1 0 1 0 0 0 0 0;
r21y -r21x -r22y r22x 0 0 0 0 1;
0 0 -1 0 1 0 0 0 0;
0 0 0 -1 0 1 0 0 0;
0 0 r32y -r32x -r33y r33x 0 0 0;
0 0 0 0 -1 0 1 0 0;
0 0 0 0 0 -1 0 1 0;
0 0 0 0 r43y -r43x -r44y r44x 0]
H = [(m2.*XG2DD);
(m2.*YG2DD+m2.*g);
(IG2.*T21DD);
(m3.*XG3DD);
(m3.*YG3DD+m3.*g);
(IG3.*T31DD);
(m4.*XG4DD);
(m4.*YG4DD+m4.*g);
(IG4.*T41DD)]
P = [inv(D).* H]

1 Comment

dpb
dpb on 17 Dec 2014
Edited: dpb on 17 Dec 2014
Your two arrays D and H are being populated by vertical concatenation via the ";" operator.
You still don't provide the information required in detail but presuming all the various rNMX variables in the D array are, in fact, single values, I rearranged it well enough to check that there are 9 values/row so it looks like it's ok (again with the above caveat).
Hence one must presume that one (or more) of the row entries in H is not of the same length as all the others. Again, use size on each component therein and you'll find the location/variable that is the problem. debug is very useful for this particularly if this construct is in a function rather than in the workspace.
It ALWAYS helps to paste the full error message in context to help readers with actual debugging data rather than having to guess...
Lines like
r21y -r21x -r22y r22x 0 0 0 0 1;
have just 9 colums:
r21y -r21x -r22y
r22x
0
0
:
Use , to separate different colums:
r21y, -r21x, -r22y, r22x, 0, 0, 0, 0, 1;

This question is closed.

Asked:

on 17 Dec 2014

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!