atleast_2d{T}(A::Union(Array{T,0},Array{T,1})) = reshape(A, size(A,1), 1)
atleast_2d{T}(A) = A

but in general I'm not sure why you'd need such a function. size(A,2) returns 
1 even if A is one-dimensional, and A[3,1] works as well.

Best,
--Tim


On Friday, March 06, 2015 01:41:28 PM Júlio Hoffimann wrote:
> Hi,
> 
> What is the equivalent in Julia for numpy.atleast_2d and numpy.atleast_3d?
> Or how would you add a ghost dimension to an array in Julia without calling
> reshape(X, m, n, 1) explicitly?
> 
> -Júlio

Reply via email to