On Monday, September 8, 2014 1:13:09 PM UTC-5, Ethan Anderes wrote:
>
> I’m a bit surprised we don’t have a method for squeeze that works like 
>
> function Base.squeeze(A) 
>   sqzindx = find(collect(size(A)) .== 1)
>   if isempty(sqzindx)
>     return A
>   else
>     return squeeze(A, tuple(sqzindx...))
>   end
> end
>
> which simply squeezes out all singleton dimensions.
>
Stefan's answer below summarizes why this isn't in Base.

https://groups.google.com/forum/#!searchin/julia-users/squeeze/julia-users/QQqVbyTiiPg/_VE3HgKIGu0J

Reply via email to