I have a specific question regarding subsetting a matrix in a loop. In Matlab, I can define a matrix like `X(N,K,T)`

, where `N`

is the number of observations, `K`

is the number of features, `T`

is the number of periods.

Now I need a `for`

loop over time `T`

, for example when `t = 1`

, I want to use `X(N,K,1)`

, when `t = T`

, I want `X(N,K,T)`

.

So can I define this three-dimensional matrix in Rstan? I read over the reference manual and did not find related info. Or are there any other alternative ways to achieve this? Thanks!!