Converting a Vector{float64} to float{64}

I have a one element vector{float64} called “Ge” that operates inside of a for loop. The code I am trying to do is result[num] = (part1+part2)/Ge in which both part 1 and part 2 are type Float64. It doesn’t let me do this because Julia doesn’t allow mathematical operations between Float64 and Vector{float64}. How can I convert any of these variables to make this math operation work?

Do you have a reproducible example? What do you expect to happen when you divide a floating point number by a vector?

1 Like

I especially like the part where result[num] is independent of the rhs.

Edit: OK, enough of our frustrations: the answer is probably broadcasting

result[num] = (part1+part2)./Ge

Perhaps you want to access the single element with Ge[1], so:

?

But a MWE would be better to help you. Please consider Please read: make it easier to help you

Ok, I will use MWE’s in the future. Yes, all I had to do was Ge[1] so I could index the exact float value from the vector, thanks for the help

You might want first or only.