Matlab Tricks
- Repeat rows in matrix separately
a = [1 2 3;4 5 6] ; % original matrix
a =
1 2 3
4 5 6
N = 2 ; % number of repetitions
b = a(repmat(1:size(a,1),N,1),:) ; % new matrix
b =
1 2 3
1 2 3
4 5 6
4 5 6