# Findn() function not found in Julia

**URL:** <https://discourse.julialang.org/t/findn-function-not-found-in-julia/87175>\
**Category:** General Usage\
**Created:** [September 13, 2022, 12:37am UTC](https://discourse.julialang.org/t/findn-function-not-found-in-julia/87175 "2022-09-13T00:37:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![m\_shah2](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@m\_shah2](https://discourse.julialang.org/u/m_shah2)\
**Post date:** [September 13, 2022, 12:37am UTC](https://discourse.julialang.org/t/findn-function-not-found-in-julia/87175/1 "2022-09-13T00:37:13Z")

</div>

I am trying to run the code:  
ai, aj = findn(triu(NA, 1))

But it throws an error of undefined variable. I don’t know which package has this function.

UndefVarError: findn not defined

Stacktrace:  
[1] top-level scope  
@ In[10]:1  
[2] eval  
@ .\boot.jl:368 [inlined]  
[3] include\_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)  
@ Base .\loading.jl:1428

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 13, 2022, 12:55am UTC](https://discourse.julialang.org/t/findn-function-not-found-in-julia/87175/2 "2022-09-13T00:55:45Z")

</div>

> [@m\_shah2](#):
>
> But it throws an error of undefined variable. I don’t know which package has this function.

What do you want the `findn` function to do?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [September 13, 2022, 1:05am UTC](https://discourse.julialang.org/t/findn-function-not-found-in-julia/87175/3 "2022-09-13T01:05:46Z")

</div>

It looks like `findn(A)` was a function in quite old versions of Julia, which was [deprecated in Julia 0.7](https://github.com/JuliaLang/julia/pull/25532) in favor of `findall(!iszero, A)`.

So, you should update your code to

```julia
aij = findall(!iszero, triu(NA,1))

```

where `aij` is now an array of [`CartesianIndex`](https://docs.julialang.org/en/v1/base/arrays/#Base.IteratorsMD.CartesianIndex), essentially a kind of multi-component index for indexing multidimensional arrays.

---

<div class="post-metadata">

**Author:** ![m\_shah2](https://avatars.discourse-cdn.com/v4/letter/m/65b543/32.png) [@m\_shah2](https://discourse.julialang.org/u/m_shah2)\
**Post date:** [September 13, 2022, 2:08am UTC](https://discourse.julialang.org/t/findn-function-not-found-in-julia/87175/4 "2022-09-13T02:08:57Z")

</div>

Thanks.
