How to replace the elements of a matrix with another matrices

3 ビュー (過去 30 日間)
S
S 2014 年 1 月 13 日
コメント済み: S 2014 年 1 月 13 日
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:-)

採用された回答

Image Analyst
Image Analyst 2014 年 1 月 13 日
編集済み: Image Analyst 2014 年 1 月 13 日
Try this:
A = [b;c;d;e]

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 1 月 13 日
repmat((1:4)',1,16)
  1 件のコメント
S
S 2014 年 1 月 13 日
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:)

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by