# I need help with the error called 'Error using vertcat Dimensions of arrays being concatenated are not consistent.'

1 Ansicht (letzte 30 Tage)
Praneeti Mitra am 26 Mai 2021
Kommentiert: Praneeti Mitra am 29 Mai 2021
I have a piece of code-
position = [0.3189, 0.2189, 0.6320, 0.5320;...
0.1927, 0.0927, 0.3883, 0.2883;...
0.3180, 0.1180, 0.4174, 0.2174;...
0.5303, 0.4303, 0.5302, 0.4302;...
0.7071, 0.6071, 0.6528, 0.5528;...
0.7277, 0.6277, 0.6528, 0.5528;...
0.9107, 0.8107, 0.4419, 0.3419;...
0.9710, 0.6710, 0.4276, 0.1276;...
0.4246, 0.3246, 0.6509, 0.5509;...
0.4246, 0.3246, 0.1785, 0.0785;...
0.5771, 0.4771, 0.6556, 0.5556;]
checkpoint = [0.1; 0.2];
A = [ones(11, 2) position];
M = [diag(checkpoint)-diag(checkpoint); -eye(2) zeros(2); zeros(2) eye(2)];
find(sum(A*M > 0, 2) == 4)
when i run this code it throws error called vertcat dimensions
Howresolve this issue?
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

David Fletcher am 26 Mai 2021
Bearbeitet: David Fletcher am 26 Mai 2021
The statement tries to stack a 2x2 on top of a (2x4) x 2
M = [diag(checkpoint)-diag(checkpoint); -eye(2) zeros(2); zeros(2) eye(2)];
x x
x x
x x x x
x x x x
x x x x
x x x x
for it to work the top 2x2 matrix would need to be padded to 2x4
Looking at it diag(checkpoint)-diag(checkpoint) doesn't make much sense - you'd just do zeros(2) in your schema. Maybe you meant to horizontally concatenate diag(checkpoint) with the unary negation of diag(checkpoint)
M = [diag(checkpoint) -diag(checkpoint); -eye(2) zeros(2); zeros(2) eye(2)];
##### 1 KommentarKeine anzeigenKeine ausblenden
Praneeti Mitra am 29 Mai 2021
thanks

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Logical in Help Center and File Exchange

R2020b

### Community Treasure Hunt

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

Start Hunting!

Translated by