This topic has received much discussion: whether to drop the dimension
of an array when indexed with a scalar or not. 

At the moment, only the last array dimension will be dropped when
indexed with a scalar.  That is what happens in your first example.

A[3,:] gives Array{Float64, 2}.

However, if indexing with a range, even of length 1, then the dimension
will never be dropped.

Whether this is the best solution remains a bone of contention (I
think).  Have a look through the mailing list archives for pros and
cons.

On Thu, 2014-06-19 at 10:18, [email protected] wrote:
> If I do this:
>
> A = rand(10, 10)
> x = A[:, 3]
>
> then typeof(x) is Array{Float64, 1}. However if I do this:
>
> A = rand(10, 10)
> x = A[:, 3:3]
>
> then typeof(x) is Array{Float64, 2}.
>
> Is this a bug, or is this behaviour the intention of the developers? In 
> case of the latter: why?

Reply via email to