Looping for replace matrix elements

17 ビュー (過去 30 日間)
Ana Rizkasari
Ana Rizkasari 2016 年 11 月 24 日
回答済み: the cyclist 2016 年 11 月 24 日
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!

採用された回答

KSSV
KSSV 2016 年 11 月 24 日
XX = [3,0,0;0,3,3;4,5,4] ;
iwant = repmat(XX,3,1);
doc repmat.

その他の回答 (1 件)

the cyclist
the cyclist 2016 年 11 月 24 日
XXnew = repmat(XX,3,1);

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by