MATLAB: How to get rid of the CAT error

catvertcat

Hi All, Please help with the following problem. I am trying to do the following: N=A^(-1)BZ where A is a 29×29 matrix and B is a 29×13 matrix. I have created these matrices as AA and BB, respectively in the attached file. While MATLAB created the AA matrix, it is giving me the following error when it comes to run the BB section: Error using vertcat CAT arguments dimensions are not consistent. Thanks for your help. Yinka

Best Answer

A is 29 by 29. B is 29x13.
They have the same number of rows, but NOT the same number of columns. You CANNOT vertically concatenate these matrices, as the result would not be rectangular. Recall they do not have the same number of columns.
You CAN horizontally concatenate them, as they have the same number of rows.