repeat a matrix in defined manner

1 vue (au cours des 30 derniers jours)
Rica
Rica le 12 Déc 2012
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

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 12 Déc 2012
Modifié(e) : Azzi Abdelmalek le 12 Déc 2012
A=[1 2 3;4 5 6;4 5 6];
m=4
B=cell2mat(arrayfun(@(x) x*ones(1,m),A,'un',0))

Plus de réponses (1)

Walter Roberson
Walter Roberson le 12 Déc 2012
Modifié(e) : Walter Roberson le 12 Déc 2012
kron(A,[1 1 1 1])
or
A(:, repmat(1:end,4,1) )

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by