How can I replicate matrix
1 次查看(过去 30 天)
显示 更早的评论
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
2012-12-2
"the remaining 15(25x25=625) should be added to the last p" What does that mean?
采纳的回答
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 Center 和 File Exchange 中查找有关 Operating on Diagonal Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!