Good day. Please can someone explain dimension in simple terms and how it applies to arrays. Also, what do singleton and non-singleton dimension mean and do they affect some builtin functions such as sum.
"Dimension dim indicates the dimension whose length reduces to 1. The size(S,dim) is 1, while the sizes of all other dimensions remain the same."
So if you want to squash your matrix down to have 1 row, yousum in dimension 1 which takes the sum of each column of data. If you want to squash your matrix to have 1 column, yousum in dimension 2 which takes the sum of each row.