The second argument in plot puzzles me, removed the "()" after S and no difference. What is the point of it?
CodePudding user response:
In this case where S is a matrix, the arguments that follow are used to take a selection of the matrix in each dimension. The : operator is used to select entries in a range (e.g. 2:end) and when used alone (i.e. :) selects all entries in a range.
The following example selects all rows (:) of the second column (2). Note that S and S(:, :, 1) in this case are identical as this array does not contain a third dimension. I believe this is also the case for your example.
>> S = [1, 2, 3; 4, 5, 6; 7, 8, 9]
S =
1 2 3
4 5 6
7 8 9
>> S(:, 2)
ans =
2
5
8

