How to get rid of the error: Error using horzcat. Dimensions of matrices being concatenated are not consistent
1 view (last 30 days)
Show older comments
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1704826/image.png)
1 Comment
the cyclist
on 27 May 2024
We can't work with a screen shot. Please post or attach the code that replicates the problem.
Answers (1)
Image Analyst
on 27 May 2024
In general, this error means that the matrix you're trying to concatenate on the right hand side of your existing matrix does not have the same number of rows as your existing matrix.
C = [A, B]; % A and B MUST have the same number of rows or you get an error.
0 Comments
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!