Categories within matrix for relatedTo
Just answering this for anyone that may come across this in the future as I have...

Could you reuse the group tag?

{% for block in entry.myMatrixField.group(&lt;catgegory here&gt;) %}
    ...
{% endfor %}


You have probably resolved it due to the age, but your answer would be helpful.