# How to replace a value at a specif place in a matrix with another value?

**URL:** <https://discourse.julialang.org/t/how-to-replace-a-value-at-a-specif-place-in-a-matrix-with-another-value/83774>\
**Category:** General Usage\
**Tags:** question, matrices\
**Created:** [July 5, 2022, 1:41pm UTC](https://discourse.julialang.org/t/how-to-replace-a-value-at-a-specif-place-in-a-matrix-with-another-value/83774 "2022-07-05T13:41:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hupdup](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@Hupdup](https://discourse.julialang.org/u/Hupdup)\
**Post date:** [July 5, 2022, 1:41pm UTC](https://discourse.julialang.org/t/how-to-replace-a-value-at-a-specif-place-in-a-matrix-with-another-value/83774/1 "2022-07-05T13:41:15Z")

</div>

Hi,  
I want to replace the value of the Matrix “q\_update” (Size: (3, 1)) at position “a”, which can be a number between 1 and 3, with a new value. The new Value at this position should be y, a float32.  
But unfortunaly it doesnt work. I Tried the following:

```
q_update[a, 1] == y

```

but unfortunaly the values don’t change:

 ![grafik](https://global.discourse-cdn.com/julialang/original/3X/4/7/47f9bcb1e9316048e36112d74cea82d3dec5b76c.png)

do you have any Idea how to do this properly?  
Thanks a lot!

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [July 5, 2022, 1:57pm UTC](https://discourse.julialang.org/t/how-to-replace-a-value-at-a-specif-place-in-a-matrix-with-another-value/83774/2 "2022-07-05T13:57:01Z")

</div>

`==` is the comparison operator, not an assignment - you want `=` instead.

---

<div class="post-metadata">

**Author:** ![Hupdup](https://avatars.discourse-cdn.com/v4/letter/h/7ba0ec/32.png) [@Hupdup](https://discourse.julialang.org/u/Hupdup)\
**Post date:** [July 5, 2022, 2:07pm UTC](https://discourse.julialang.org/t/how-to-replace-a-value-at-a-specif-place-in-a-matrix-with-another-value/83774/3 "2022-07-05T14:07:00Z")

</div>

ok that was easy, thanks a lot!
