Due to the help of some posts on StackExchange (mostly [1] and [2]) I think that I got the gist of categorizing matrix rows and columns with braces and separating them with lines in TikZ. However, I can't get the referencing of the positions in the draw command to work, strangely enough only within a certain matrices. The examples in the links (4x4 matrices) compile flawlessly, but the bigger matrix below doesn't. (I only exchanged the smaller matrices in the examples with the bigger matrix.)

Specifically, I get the error message "!Package pgf Error: No shape named m-4-2 is known.", which occurs in the first line where the dashed line is drawn. However, the shapes named m-1-3 and m-1-2 are known. I am out of my wits here, as I can't make a connection between the errors and the code that could be wrong.