Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- columns = 40;
- rows = 9;
- data = Table[i*100 + j, {i, rows}, {j, columns}];
- dt = 2;
- steplength = 5*dt;
- steps = Floor[columns/steplength];
- shifts = Floor[steplength/Abs[dt]];
- partdata = Partition[data, {rows, steplength}];
- Do[step[i] = partdata[[1]][[i]], {i, steps}];
- Do[dtstep[i] = Partition[step[i], {rows, Abs[dt]}], {i, steps}];
- Do[shiftdtstep[i][j] = ArrayPad[dtstep[i][[1]][[j]], {If[dt >= 0, {shifts - j, j - 1}, {j - 1, shifts - j}],{0,0}}], {i, steps}, {j, shifts}];
- Do[shiftedstep[i] = ArrayReshape[Transpose[Table[shiftdtstep[i][j], {j, shifts}]], {rows + shifts - 1,Abs[dt]*shifts}], {i, steps}];
- shifteddata = ArrayReshape[Transpose[Table[shiftedstep[i], {i, steps}]], {rows + shifts - 1, steps*steplength}];
- data // MatrixForm
- shifteddata // MatrixForm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement