Looping for replace matrix elements
Show older comments
Helo,
I have matrix 3x3, let's say
XX = [3,0,0;
0,3,3;
4,5,4]
I want to generate matrix 9x3 which value same with matrix XX every forth row. as illustration:
XXnew = zeros (9,3)
as result :
XXnew = [3,0,0;
0,3,3;
4,5,4;
3,0,0;
0,3,3;
4,5,4;
3,0,0;
0,3,3;
4,5,4];
How to code with "for end" function.
Thank you!
Accepted Answer
More Answers (1)
the cyclist
on 24 Nov 2016
XXnew = repmat(XX,3,1);
Categories
Find more on Creating and Concatenating Matrices 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!