Can't access data in Matrix field Stuck on a problem at the moment… trying to output a Rich Text field (copy) from an entry. The copy is contained in a matrix field (so: Entry -> Matrix Field -> Copy Field) but I can’t access it no matter what I try.

The Matrix Field Type is genericContent, the entry is relatedContent and the copy field is simply named copy.

Here's the code I currently have, I've tried various other options but none work.

{% set entries = entry.relatedContent %}

{% for entry in entries %}
    {% switch entries|length %}
        {% case '1' %}
            one
        {% case '2' %}
            &lt;article class="t{% if loop.first %} t--tall{% endif %}"&gt;
                &lt;div class="content"&gt;
                    &lt;span class="subtitle"&gt;{{ entry.sectionTag.first }}&lt;/span&gt;
                    &lt;h1&gt;{{ entry.title }}&lt;/h1&gt;
                    &lt;p&gt;{{ entry.genericContent.copyMatrix.copy.first }}&lt;/p&gt;
                &lt;/div&gt;
            &lt;/article&gt;
            &lt;pre&gt;{{dump(entry.genericContent.copyMatrix.copy.first)}}&lt;/pre&gt;
            &lt;br&gt;
        {% case '3' %}
            three
        {% case '4' %}
            four
    {% endswitch %}
{% endfor %}
You're close! The relatedContent field is an ElementCriteriaModel, so you need to loop over it (or otherwise treat it somewhat like an array) to get to the entries.

The matrix field is also an array like thing, and you need to loop over it to get at the blocks. See here

Here is what I would do (assuming the matrix field handle is genericContent:

{% for oneRelatedContent in entry.relatedContent %}
  {% for block in oneRelatedContent.genericContent %}
    &lt;article class="t{% if loop.first %} t--tall{% endif %}"&gt;
      &lt;div class="content"&gt;
        &lt;span class="subtitle"&gt;{{ oneRelatedContent.sectionTag.first }}&lt;/span&gt;
        &lt;h1&gt;{{ oneRelatedContent.title }}&lt;/h1&gt;
        {{ copy }}
      &lt;/div&gt;
    &lt;/article&gt;
  {% endfor %}
{% endfor %}


You want to use loop.index to tell you which matrix block this is.
If you need to count the entries in relatedContent, you will need loop.parent.loop.index Loop variable