In this particular example, why not use
rand()
instead of
rand(1,1)
?
On Saturday, October 31, 2015 at 5:33:05 PM UTC+1, Xiaowei Song wrote:
>
> v=zeros(2,3)
> x=rand(1,1)
> v[2,1]=x
> # `convert` has no method matching convert(::Type{Float64},
> ::Array{Float64, 2})
>
> #work around
> function returnNum(x)
> return x[1]
> end
> v[2,2]=returnNum(v)
>
> Has anyone encountered this situation and want a change?
> Is there any other better work around?
> Or should Julia add the automatic conversion from 1x1 matrix to a num?
>
> Thanks,
>