Hello Adam,
With the current information it is difficult to identify and solve the problem. It seems to me that some debugging is required, which probably requires a close look at your data and your code. I would suggest that you try to identify in which line of your code the problem occurs, I do this printing text at different points of the code. Once you have identified were the problem is, I would try to print the dimensions of the matrices you are operating over, the value of the subscript you are working with, and a subset of the matrices you are working with. Printing the subscript and the dimensions of the matrices will help you see why "the subscript is invalid". Printing a subset of the matrix is relevant to see if the matrices are not void. If all this is insufficient to identify your problem, I would suggest that you email technical support with your data and do-file.
With the current information it is difficult to identify and solve the problem. It seems to me that some debugging is required, which probably requires a close look at your data and your code. I would suggest that you try to identify in which line of your code the problem occurs, I do this printing text at different points of the code. Once you have identified were the problem is, I would try to print the dimensions of the matrices you are operating over, the value of the subscript you are working with, and a subset of the matrices you are working with. Printing the subscript and the dimensions of the matrices will help you see why "the subscript is invalid". Printing a subset of the matrix is relevant to see if the matrices are not void. If all this is insufficient to identify your problem, I would suggest that you email technical support with your data and do-file.
Comment