Fill values from different matrices size

2 ビュー (過去 30 日間)
Daniel
Daniel 2011 年 10 月 27 日
Hello,
I want to know how I can put the values of a matrix 3x3 into a matrix of 6x6 (for example), adding zeros in the not pair rows and colums, just like that:
A B C
D E F
G H I
into:
A 0 B 0 C 0
0 0 0 0 0 0
D 0 E 0 F 0
0 0 0 0 0 0
G 0 H 0 I 0
0 0 0 0 0 0
Thank you very much!

採用された回答

Grzegorz Knor
Grzegorz Knor 2011 年 10 月 27 日
For example:
a = rand(3);
b = zeros(6);
b(1:2:end,1:2:end) = a

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by