I’ve not looked closely at your code but this error usually comes when you are counting your loops wrong and either have not enough loops for your data or too many counts than the amount of loops (meaning you are calling an index that does not exist aka index out of range). Double check your lines where you call colIndex or doing .counts.
Some strange things in this code.
You are adding to a temp list from outside an if statement that only exists inside the if statement.
you are adding to these lists outside of the foreach loop.
In this line you are adding a list to another list which would be .AddRange()
Actually I realized it is a List List (matrix) in which case arrays will be easier.
I could help more but it is not exactly clear to me what the results should be.