Explanation

Comment with percent (%) following comma acts as a row separator. Your use of a comma suggests that you are trying to create a row vector, rather than a column vector. Within array initializations, this can cause unintended errors by spitting an into separate rows in unintended locations.


Suggested Action

To comment within an array without splitting rows, replace the percent (%) with an ellipsis().

OldNew

The comment acts as a row separator causing the array to have uneven dimensions.

This generates an error.

x = [ 1, 2, ...
      % My comment
      3, 4, ...
      5, 6];

The comment does not act as a row separator.

x = [ 1, 2, ...
      ... My comment
      3, 4, ...
      5, 6];

If the row separation is intentional, replace the comma with a semicolon to make the row separation clearer.