Element-wise creation of Matrix
1 回表示 (過去 30 日間)
古いコメントを表示
Navdeep Singh
2016 年 10 月 28 日
コメント済み: Walter Roberson
2016 年 10 月 28 日
How can we create element wise matrix from 4 matrices without using loops. For ex.we have
A=[a1 a2;a3 a4] B=[b1 b2;b3 b4] C=[c1 c2;c3 c4] D=[d1 d2;d3 d4]
We need to create an array such that each array location contains values such as
R=[a1 b1;c1 d1] %Matrix on First location
S=[a2 b2;c2 d2] %Matrix on Second location
and so on so that all the elements are covered.
Thanks in advance.
採用された回答
Walter Roberson
2016 年 10 月 28 日
idx = 1;
R = [A(idx), B(idx); C(idx), D(idx)]
?
2 件のコメント
Walter Roberson
2016 年 10 月 28 日
cellfun(@(a, b, c, d) [a, b;c, d], A, B, C, D, 'uniform', 0)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!