Problem 760. Duplicate each element of a vector.
Solution Stats
Problem Comments
Solution Comments
-
1 Comment
Harish Maradana
on 23 Aug 2014
improve test suit
-
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
Problem Recent Solvers545
Suggested Problems
-
How to find the position of an element in a vector without using the find function
2563 Solvers
-
684 Solvers
-
Given a window, how many subsets of a vector sum positive
813 Solvers
-
Matlab Basics - y as a function of x
401 Solvers
-
2514 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!