I used findwith a 3D matrix Aas follows:
julia> find(A.==1)
2-element Array{Int64,1}:
1
234
4567
Julia gives me location as an index, not as an array of indexes. For example, it returns 234 instead of (1,2,1).
I considered this question , but my matrix is very large and has a shape (360,360,360). I can not use the proposed method.
I tried to examine its index pattern and convert it using the function that I encoded:
function cmf_p(matrix)
for a=1:length(matrix);
aa=matrix[a]
rd_u_m=ceil(aa/(360^2))
rd_d_m=floor(aa/(360^2)-1)
rd_d_t=(aa-rd_d_m*360)/360^2
rd_d_p=aa-rd_d_m*360^2-floor(rd_d_t)*360
println(rd_u_m);
println(ceil(rd_d_t)*360);
println(ceil(aa-rd_d_m*360^2-floor(rd_d_t)*360))
end
end
But that gives me the wrong result.
How can I use an index and convert it to the right place?
source
share