Columns with implicit meaning

IDFCNS-15
TitleAvoid the use of matrices in which rows or columns have implicit meaning.
PriorityStrongly recommended
Severity level5
DescriptionAvoid the use of matrices in which rows or columns have implicit meaning. Use individual vectors, structs or tables instead.
RationaleUsing matrices with implicit row or column meanings reduces the readability and robustness of the code.

Avoid:

% data is a matrix.
density = data(:, 1) ./ (data(:, 2) .* data(:, 3) * data(:, 4));

Instead use:

% data is a table or struct of arrays.
density = data.mass ./ (data.height .* data.width .* data.length);

% Alternatively, with individual vectors.
density = mass ./ (theHeight .* theWidth .* theLength);