matrix operation make matrix
古いコメントを表示
i want to make matrix. for manual way or the output
A=[1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 ... 8 8 8 8 8 8 8 8];
for A, each value until 8 times the value will be add by 1.
b=[1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 ... 1 2 3 4 5 6 7 8];
for b, value 1-8 will be looping until 8 times.
so the size A is 1x64 and B is 1x64
2 件のコメント
Andrei Bobrov
2013 年 3 月 23 日
A = kron(1:8,ones(1,8));
B = kron(ones(1,8),1:8);
Azzi Abdelmalek
2013 年 3 月 23 日
kron is less faster
採用された回答
その他の回答 (1 件)
Matt Kindig
2013 年 3 月 23 日
A = reshape(repmat((1:8), 8, 1), 1, [])
b = repmat(1:8, 1, 8)
カテゴリ
ヘルプ センター および 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!