I want to create a matrix A of undefined values and have the following code that works just fine.
A = Matrix{Tuple{Float64, Array{Int64, 1}}}(undef, 100, 100)
Later, I want to check if a particular cell is undefined and if so, assign a value after computing it. I tried isdefined(A, i, j)
but that gave an error for too many arguments. How can I check for #undef
and assign only if it is undefined?
The documentation on isdefined
provides a method only for a single dimensional array, how do I achieve the same on a matrix?
Use isassigned
:
julia> A[2,3]=(3.0, [])
(3.0, Any[])
julia> isassigned(A,2,3)
true
julia> isassigned(A,3,3)
false