MATLAB: How does the syntax (:) work?
- by user198729
Given the following example:
>> I=[2 1 3;3 2 4]
I =
2 1 3
3 2 4
>> I(:)
ans =
2
3
1
2
3
4
>> I(1:2)
ans =
2 3
Why does I(:) return a column vector while I(1:2) returns a shorter row vector?