plz help how can repetition rows matrix
1 view (last 30 days)
Show older comments
how can repetition rows matrix deponds number if i have a=[ 1 0 0 ;0 0 1; 0 1 0] and n=4
i wanna have rep_a=[ 1 0 0; 0 0 1; 0 1 0 ;1 0 0]
if n=5 rep_a=[ 1 0 0; 0 0 1; 0 1 0 ;1 0 0;0 0 1]
2 Comments
Accepted Answer
Jan
on 24 Jul 2021
a = [1 0 0; 0 0 1; 0 1 0];
rows = size(a, 1);
n = 5;
index = rem(0:n-1, rows) + 1
b = a(index, :)
More Answers (0)
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!