MATLAB: Do I get a matrix dimension error when using the Assignment block with a 1-D signal in Simulink

simulink

Suppose my model contains an Assignment block that I use to replace just one row or column of a matrix signal. However, if I input a properly sized replacement vector from a source block (such as a Constant block) I receive a matrix dimension mismatch error.

Best Answer

  • When replacing just one row or column of a matrix signal, the Assignment block requires the size of the signal that constitutes the replacement vector to be "1xn" or "nx1". Unless you disable the "Interpret vector parameters as 1-D" option on the source block dialog box, the size of that signal is "n".
    To workaround this issue, ensure that the "Interpret vector parameters as 1-D" option is disabled.