I want to write this code below
using vectorisation @. so that i don’t iterate in for loops.
for b in 1:872
xs = x[:, b]
ys = y[:, b]
zs = z[:, b]
for i in 1:length(xs), j in 1:length(ys), k in 1:length(zs)
r, θ, ϕ = xs[i], ys[j], zs[k]
X = r * sin(θ) * cos(ϕ)
Y = r * sin(θ) * sin(ϕ)
Z = r * cos(θ)
push!(all_xs, X)
push!(all_ys, Y)
push!(all_zs, Z)
end
end
Is my x, y and z array reshaping code of first starting post wrong? ![]()