MATLAB: Need help understanding arrays

arrayselementsindex

Let's say I have an array A = [1 2 3; 4 5 6]
A =
1 2 3
4 5 6
A(1:2) would simply be
1
4
And A(2:3) would be
4
2
Basically the the 1st and 2nd elements and the 2nd and 3rd elements.
So why then is A(1:2, 2:3)
2 3
5 6
Instead of
1 2
4 5
This is probably a silly question, but I just can't seem to understand this.

Best Answer

for your case:
A ([1:2,2:3])
for:
A(1:2,2:3);% 1:2 - numbers rows, befor the comma
% 2:3 - numbers columns, after the comma