The error "Error using horzcat CAT arguments dimensions are not consistent." occurs because the number of rows in each matrix being horizontally concatenated (horzcat) are not the same.
In the example you provided, you are trying to horizontally concatenate [eye(3),2ones(2,3)] with [3ones(2,5)]. The first matrix has 3 rows while the second matrix has 2 rows.
To fix this error, you can either adjust the dimensions of the matrices so that they have the same number of rows, or you can vertically concatenate (vertcat) the matrices instead of horizontally concatenating them.
If you want to vertically concatenate the matrices, you can use the following code:
main.m40 chars2 lines
This will result in x being a matrix with 7 rows and 5 columns.
Alternatively, if you want to horizontally concatenate the matrices, you can adjust the dimensions of the second matrix to have 3 rows instead of 2. Here's an example:
main.m40 chars2 lines
This will result in x being a matrix with 3 rows and 8 columns.
gistlibby LogSnag