Info
Cette question est clôturée. Rouvrir pour modifier ou répondre.
Is there a way for creating n number of new rows from one row?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Let my matrix be
a=[1 2 3 4
5 6 7 8]
Then I want to create n=8 new rows from the first row according to this logic.
newrow_1=firstrow +/- (rand()/k)* firstrow
And it goes on newrow_2.... till newrow_8.
1 commentaire
Walter Roberson
le 19 Mai 2016
The logic would be much the same as for http://www.mathworks.com/matlabcentral/answers/284730-creating-certain-amount-of-new-rows-from-each-row-in-a-matrix
Réponses (1)
Ahmet Cecen
le 19 Mai 2016
Modifié(e) : Ahmet Cecen
le 19 Mai 2016
A much more robust version of that reference answer, especially if you need to repeat every row the same amount of times, and you have a lot of rows:
b = repmat(a',[4,1]);
c = reshape(b,[4,8])';
or:
b = repmat(a',[numberoftimestorepeat,1]);
c = reshape(b,[size(a,2),size(a,1)*numberoftimestorepeat])'
0 commentaires
Cette question est clôturée.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!