Update. It turned out that the error was still different. Further down the 
script I had another similar line

      t = gmt(@sprintf("filter1d -Fm1 -T%d/%d/1 -E", sampr1, sampr2), 
ship_pg)

and was this line that was causing the error (because 'sampr1, sampr2' was 
not accepted, only sampr1[1], sampr2[1]) but the error message was very 
misleading because it accused the first occurrence of @sprintf()

Julia v0.4 on Win 

segunda-feira, 26 de Outubro de 2015 às 23:37:00 UTC, J Luis escreveu:
>
> It took me a while to figure out why it was erroring
>
> Given this piece of a script
>
> @show(sampr1, sampr2)
> @show(typeof(sampr1), typeof(sampr2))
> @show(@sprintf("-T%d/%d/1", sampr1[1], sampr2[1]))
>
> it error ed with an incomprehensible error
>
> sampr1 = [-1167.0]
> sampr2 = [1169.0]
> typeof(sampr1) = Array{Float64,2}
> typeof(sampr2) = Array{Float64,2}
> @sprintf("-T%d/%d/1",sampr1[1],sampr2[1]) = "-T-1167/1169/1"
> ERROR: TypeError: non-boolean (Array{Bool,2}) used in boolean context
>  [inlined code] from show.jl:127
>
> it turned out that it wanted
>
> @show(@sprintf("-T%d/%d/1", sampr1[1,1], sampr2[1,1]))
>
> but the sampr1 & sampr2 are the result of a previous computation so not at 
> all obvious of what was going on. Specially because accessing sampr1[1] is 
> a perfectly valid statement
>
> julia> sampr1 = zeros(1,1);
> 1x1 Array{Float64,2}:
>  0.0
>
> julia> sampr1[1]
> 0.0
>
>

Reply via email to