How do I output the value of a field from a Category selected from a Matrix? I'm new to craft so this is a bit newbie question.

I have a category group with a set of categories, each category has a plain text field associated with it. The category group is then used as a field in a Matrix so the user can select one of the categories in the group. Basically all I want to do is list the plain text field from the selected category onto the page. 

I tried working something out from https://craftcms.com/docs/relations (Going through a matrix section) but I just kept breaking everything. Any assistance would be appreciated!

Thanks.
Without knowing what your field handles are, this is the gist of how you’d do it:

{#
   Loop through each block within your Matrix field,
   assigning them to a `block` variable:
#}

{% for block in entry.myMatrixField %}

    {#
       Loop through each category within this Matrix block,
       assigning them to a `category` variable:
    #}

    {% for category in block.myCategoriesField %}

        {#
           Output the plain text field value:
        #}

        &lt;p&gt;{{ category.myPlainTextField }}&lt;/p&gt;

    {% endfor %}

{% endfor %}