Error using vertcat Dimensions of matrices being concatenated are not consistent.

3 vues (au cours des 30 derniers jours)
mika
mika le 16 Mai 2014
Commenté : mika le 17 Mai 2014
this error occur when make lines connecting center and points buy this code
% make lines connecting center and points
x00 = [xyr([1 1 1]) ; px ; xyr([1 1 1])] ;
y00 = [xyr([2 2 2]) ; py ; xyr([2 2 2])] ;
  • xyr vector of two points that i want to connect and the radius
*px and py coordinates of points
>> px
px =
3
8
10
>> py
py =
791
388
570
and
>> xyr([1 1 1])
ans =
1.0e+03 *
-4.7159 -4.7159 -4.7159
>> xyr([2 2 2])
ans =
530.9219 530.9219 530.9219
Any idea please!
thak you.

Réponse acceptée

dpb
dpb le 16 Mai 2014
Modifié(e) : dpb le 16 Mai 2014
You're trying to write the equivalent of
Z = [1 2 4; ...
3 ; ...
8 ; ...
9 ; ...
8 5 2];
Can't do that unless Z is a cell array containing two 3x1 and a 1x3 array.
You needs must write
x00 = [xyr(1,1,1) ; px.' ; xyr([1 1 1])] ;
or create px as a row vector instead of column to have a square array.
As said, not sure what you then intend to do with the result; from looking at the data values doesn't look to me quite like what line input array likely is needing to be, but this solves your concatenation problem first; can look at the result next.
  3 commentaires
dpb
dpb le 16 Mai 2014
Oh, senior moment, sorry. Forgot px is already a vector just oriented wrong...edit in previous answer.
mika
mika le 17 Mai 2014
thank you a lot
you make my day

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by