repeat a matrix in defined manner

1 回表示 (過去 30 日間)
Rica
Rica 2012 年 12 月 12 日
hi! How could i generate from this matrix:
A=[1 2 3
4 5 6
4 5 6]
this matrix:
B= [1 1 1 1 2 2 2 2 3 3 3 3
4 4 4 4 5 5 5 5 6 6 6 6
4 4 4 4 5 5 5 5 6 6 6 6]
thank you

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2012 年 12 月 12 日
編集済み: Azzi Abdelmalek 2012 年 12 月 12 日
A=[1 2 3;4 5 6;4 5 6];
m=4
B=cell2mat(arrayfun(@(x) x*ones(1,m),A,'un',0))

その他の回答 (1 件)

Walter Roberson
Walter Roberson 2012 年 12 月 12 日
編集済み: Walter Roberson 2012 年 12 月 12 日
kron(A,[1 1 1 1])
or
A(:, repmat(1:end,4,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