In reply to Ian Wakeling.

I like it. You don't even need to use the Kroneker product operator (@); a simple outer product will do:
matIdx = t(0:(n-1)) * j(1,k,k) + j;