필터 지우기
필터 지우기

How can I replicate matrix

조회 수: 1 (최근 30일)
Ede gerlderlands
Ede gerlderlands 2012년 12월 2일
I have p(x) which has 25 values. I want 640 values in such away that each of p(x)'s are replicated 25 times and the remaining 15(25x25=625) should be added to the last p. I tried this way but not ok
for ii = 1 :length(p);
p2=repmat(p(i) , [1 25]);
end;
thanks for your help.
btw, is there any way of adding the remaining 15 values proportionally.
  댓글 수: 2
José-Luis
José-Luis 2012년 12월 2일
"the remaining 15(25x25=625) should be added to the last p" What does that mean?
Ede gerlderlands
Ede gerlderlands 2012년 12월 2일
I want 640 values . When i REPLICATE i will have 625 values(25x25) and there still remains 640-625=15. This 15 values should be obtained from the last value, i.e.,p(25)should be replicated 40 times.

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

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2012년 12월 2일
편집: Azzi Abdelmalek 2012년 12월 2일
p=1:25
a=repmat(p,25,1)
out=[a(:);ones(15,1)*p(end)]

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by