I want to generate arbitrary matrix of indeces, e.g.:
1 2 3 42 3 4 53 4 5 64 5 6 75 6 7 86 7 8 9
One can observe a series in it. I solved the problem as follows:
% --- Inputs
x = 1:9;window = 4;% --- creating the matrix
mm = length(x);nb_rws = mm - window + 1;y = ones(nb_rws,window);for i = 1 : nb_rws y(i,:) = x(i : i + window -1); endy
Is there a solution to avoid the for loop? Thanks..
Best Answer