How to create a couple of matrix variables with different dimension?

What is wrong with just declaring separate matrix variables?
variable X1(5,5) X2(6,6)

If there are a large number of variables and you wish to do so in an automated way, use string concatenation to create “variable” variable names.

You can also create cell arrays of MATLAB variables. For instance,

variable X1(5,5) X2(6,6)
Fred = {X1,X2}