Looping for replace matrix elements

17 Ansichten (letzte 30 Tage)
Ana Rizkasari
Ana Rizkasari am 24 Nov. 2016
Beantwortet: the cyclist am 24 Nov. 2016
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!

Akzeptierte Antwort

KSSV
KSSV am 24 Nov. 2016
XX = [3,0,0;0,3,3;4,5,4] ;
iwant = repmat(XX,3,1);
doc repmat.

Weitere Antworten (1)

the cyclist
the cyclist am 24 Nov. 2016
XXnew = repmat(XX,3,1);

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by