# Find indices of boundary nodes

**URL:** <https://discourse.julialang.org/t/find-indices-of-boundary-nodes/114493>\
**Category:** General Usage\
**Tags:** question\
**Created:** [May 21, 2024, 7:35am UTC](https://discourse.julialang.org/t/find-indices-of-boundary-nodes/114493 "2024-05-21T07:35:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Post date:** [May 21, 2024, 7:35am UTC](https://discourse.julialang.org/t/find-indices-of-boundary-nodes/114493/1 "2024-05-21T07:35:40Z")

</div>

Given the code

```julia
foo(x,y) = x+y 
xvec = range(0,1,length=5)
yvec = range(0,1,length=5)
fvec = vec(foo.(xvec,yvec'))

```

Q1: how to find indices on fvec that correspond to start/end point of xvec/yvec ?

Q2: how to overwrite values of fvec that correspond to start/end point of xvec/yvec ?

Thx!

---

<div class="post-metadata">

**Author:** ![jakobnissen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakobnissen/32/13477_2.png) [@jakobnissen](https://discourse.julialang.org/u/jakobnissen)\
**Post date:** [May 21, 2024, 7:52am UTC](https://discourse.julialang.org/t/find-indices-of-boundary-nodes/114493/2 "2024-05-21T07:52:19Z")

</div>

Vectors are column vectors in Julia. Hence, in `foo.(xvec, yvec')`, the first column correspond to the first element of `xvec`, and the first row correspond to the first element of `yvec`.

Since matrices are column-ordered in Julia, that means the indices `1:5` correspond to the start point of `xvec`, `21:25` to the last point, `1:5:21` the first point of `yvec`, `5:5:25` the last point of `yvec`.

To overwrite them with `19`, you could do e.g. `fvec[1:5:21] .= 19`

---

<div class="post-metadata">

**Author:** ![Domenico\_Lahaye](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/domenico_lahaye/32/203728_2.png) [@Domenico\_Lahaye](https://discourse.julialang.org/u/Domenico_Lahaye)\
**Post date:** [May 21, 2024, 7:53am UTC](https://discourse.julialang.org/t/find-indices-of-boundary-nodes/114493/3 "2024-05-21T07:53:56Z")

</div>

Or use LinearIndices.
