Why do I get the error Dimensions of arrays being concatenated are not consistent?

3 views (last 30 days)
This is my code. How can I fix this problem?

Accepted Answer

Cris LaPierre
Cris LaPierre on 30 Dec 2020
I'm going to guess it's because you are trying to combine 2+ arrays that have a different number of columns. Specifically, when you create b, you are combing three rows.
  • the first row has 3 elements
  • the second row has 3 elements
  • the third row and 1 element.
All rows must have the same number of elements in order to concatenate them together vertically.

More Answers (0)

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!