Hello, I want to convert this MATLAB for loop into RStudio:
p=24;
t=455;
for i=1:p-1
Y=[Y; y(:,p-i:t-i)];
end;
The Y matrix has a dimension 4x432 and y matrix is 4x455.
The code I tried in RStudio is:
for (i in 1:p-1) {
Y<- rbind(Y, y[,p-i:t-i])
}
However, I am getting an error which says: Error in y[, p - i:t - i] : subscript out of bounds.
Based on the output in MATLAB, the Y matrix must become a 96 by 432 matrix after running the above for loop.
Thank you very much.