repeat a matrix in defined manner
30 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
Azzi Abdelmalek
am 12 Dez. 2012
Bearbeitet: Azzi Abdelmalek
am 12 Dez. 2012
A=[1 2 3;4 5 6;4 5 6];
m=4
B=cell2mat(arrayfun(@(x) x*ones(1,m),A,'un',0))
0 Kommentare
Weitere Antworten (1)
Walter Roberson
am 12 Dez. 2012
Bearbeitet: Walter Roberson
am 12 Dez. 2012
kron(A,[1 1 1 1])
or
A(:, repmat(1:end,4,1) )
0 Kommentare
Siehe auch
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!