MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Todayfor an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice. Example : in->[2 3 NaN 5] and out->[2 2 3 3 NaN NaN 5 5]

302 correct solutions
156 incorrect solutions

Last solution submitted on Sep 16, 2014

1 Comment

Rona
on 7 Jul 2013

This solution only works for vectors that are already sorted from low to high :) but it passed the test suite

1 Comment

Duane Hanselman
on 31 Dec 2012

This works in R2012b, but not on cody
function ans = duplicate(x)
[x;x];
x(:)';
end

1 Comment