# Assigning value from a matrix to a dictionary with key as pairs(i,j)

**URL:** <https://discourse.julialang.org/t/assigning-value-from-a-matrix-to-a-dictionary-with-key-as-pairs-i-j/98548>\
**Category:** New to Julia\
**Tags:** dictionaries\
**Created:** [May 9, 2023, 12:41pm UTC](https://discourse.julialang.org/t/assigning-value-from-a-matrix-to-a-dictionary-with-key-as-pairs-i-j/98548 "2023-05-09T12:41:47Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![barucden](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barucden/32/26154_2.png) [@barucden](https://discourse.julialang.org/u/barucden)\
**Post date:** [May 9, 2023, 1:02pm UTC](https://discourse.julialang.org/t/assigning-value-from-a-matrix-to-a-dictionary-with-key-as-pairs-i-j/98548/3 "2023-05-09T13:02:52Z")

</div>

As @Dan indicated, the problem is likely in the `dur` variable. It appears to be of type `Dict{Pair{Int16, Int16}, Float16}` but your structure expects type `Matrix{Float16}`. Therefore, when you call the constructor `Ld(Pg_Dict, Pd_Dict, dur)`, Julia implicitly invokes `convert(Matrix{Float16}, dur)`, which fails.

Also, please, read the following instructions and try to adapt your posts accordingly:

> [@Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757):
>
> Welcome to the Julia Discourse! We are enthusiastic about helping Julia programmers, both beginner and experienced. This public service announcement (PSA) outlines best practices when asking for help. Following these points makes it easier for us to help you and more likely you’ll get a prompt, useful answer. Keywords are highlighted to make it easier to refer to specific points. Choose a descriptive title that captures the key part of your question, eg “plots with multiple axes” instead of …

---

_[View the full topic](https://discourse.julialang.org/t/assigning-value-from-a-matrix-to-a-dictionary-with-key-as-pairs-i-j/98548)._
