Concatenate two matrices regardless of their type. Due to the implementation of the matrix concatenation in Octave being hard-coded for the types it knowns, user types can not use the matrix concatenation operator. Thus for the Galois and Fixed Point types, the in-built matrix concatenation functions will return a matrix value as their solution.
This function allows these types to be concatenated. If called with a user type that is not known by this function, the in-built concatenate function is used.
If dim is 1, then the matrices are concatenated, else if dim is 2, they are stacked.