This is exactly the same as the answer in MethodError: no method matching -(::Int64, ::Array{Float64,1}) - #3 by aaron.
ifelse works on scalars so if you want to do it elementwise use the dot syntax, ifelse.(...).
This is exactly the same as the answer in MethodError: no method matching -(::Int64, ::Array{Float64,1}) - #3 by aaron.
ifelse works on scalars so if you want to do it elementwise use the dot syntax, ifelse.(...).