Rather than using four-dimensional matrices to represent this, TomSym continues to work in two dimensions.
TomSym has a variety of functions, among them: The TomSym symbolic source transformation makes it possible to define any the set of decision variables (both continuous and integer) and any type of constraint as well as scalars and constant parameters.
This example also shows how to convert the model into a general TOMLAB problem.
tomSym makes it possible to build models with two or more variable indices in MATLAB.
The variable is then used to create a constraint over two of the indices and to sum the multiplication with a two-dimensional matrix.