How to replace the elements of a matrix with another matrices

3 vues (au cours des 30 derniers jours)
S
S le 13 Jan 2014
Commenté : S le 13 Jan 2014
Hi all,
How to replace the elements of a matrix with another matrices in one go with just a command?
for example: A = zeros(4,16) I want to replace the rows of A with the following matrices:
b=[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
c=[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
d=[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3]
e=[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4]
Thanks for your help.
Best wishes, S:-)

Réponse acceptée

Image Analyst
Image Analyst le 13 Jan 2014
Modifié(e) : Image Analyst le 13 Jan 2014
Try this:
A = [b;c;d;e]

Plus de réponses (1)

Azzi Abdelmalek
Azzi Abdelmalek le 13 Jan 2014
repmat((1:4)',1,16)
  1 commentaire
S
S le 13 Jan 2014
Thanks for your quick reply Azzi. But matrices b to e are just examples here, and in my case they do not have such a simple elements. Thanks anyway:)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Shifting and Sorting 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