
In addition, there are special cases where the step is defined to be a different
integer number other than 1. Some paradigms follow:
Matlab’s command:
>> A(:,1), A(1,:), A(:,1:3), A=[A', A'.*2], A(2:3,3:4)
>> A(1:3,1:2)=A(2:end,3:end)
Matlab’s response:
ans =
1
-2
ans =
1 -2 5 -3
ans =
1 -2 5
-2 2 4
A =
1 -2 2 -4
-2 2 -4 4
5 4 10 8
-3 1 -6 2
ans =
-4 4
10 8
ans =
-2 -4
A =
-4 4 2 -4
10 8 -4 4
-6 2 10 8
-3 1 -6 2
Comments:
The first command, instructs for the extraction of the first column
whilst the second for the extraction of the first row. The following
one instructs for the extraction of the 1
st
, 2
nd
and 3
rd
columns.
Afterwards,
A
A is re-built; the following command instructs for the
extraction of the sub-matrix that is composed from the elements
of
A
A that are included in: 2
nd
and 3
rd
row – 3
rd
and 4
th
columns.
The following command is a special case where the step in the
colon expression is different than 1. The last command is a more
tricky use of the colon.
Kommentare zu diesen Handbüchern