If the matrix size is constant once the simulation has started, you can simply set the dimensions in the block parameters. To make it easier, consider using Simulink.Parameters for the dimensions instead.
If the matrix size will change between simulation steps, you can use variable size signals.