matrix operation make matrix

조회 수: 4 (최근 30일)
Internazionale
Internazionale 2013년 3월 23일
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
Andrei Bobrov 2013년 3월 23일
A = kron(1:8,ones(1,8));
B = kron(ones(1,8),1:8);
Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 23일
kron is less faster

댓글을 달려면 로그인하십시오.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 3월 23일
a=repmat(1:8,8,[]);
b=a'
a=a(:)'
b=b(:)'

추가 답변 (1개)

Matt Kindig
Matt Kindig 2013년 3월 23일
A = reshape(repmat((1:8), 8, 1), 1, [])
b = repmat(1:8, 1, 8)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by