repmat

22 次查看(过去 30 天)
osman yurdakul
osman yurdakul 2011-3-22
i try to create an array as following by using repmat() function:
i have h array
h = [1 2 3 4 5]
and i want to carry out this:
h2 = [1 1 2 2 3 3 4 4 5 5]
by using repmat() func. i want to make each element of this array(h) double like in h2... please help me out ...

采纳的回答

Matt Fig
Matt Fig 2011-3-22
N = 2; % The number of times each element will repeat...
h2 = reshape(repmat(h,N,1),1,N*length(h))
  4 个评论
Walter Roberson
Walter Roberson 2011-3-22
h2 = reshape(repmat(h,N,1),numels(h)*N,1);
osman yurdakul
osman yurdakul 2011-3-22
thanks for your helping. That's been really worked.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by