Duplicate each element of a vector. - MATLAB Cody - MATLAB Central

Problem 760. Duplicate each element of a vector.

Difficulty:Rate

for 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]

Solution Stats

64.54% Correct | 35.46% Incorrect
Last Solution submitted on Oct 27, 2025

Problem Comments

Solution Comments

Show comments
Join Cody Contest 2025 — Have Fun and Win Prizes!
...
We’re excited to invite you to Cody Contest 2025! 🎉 Pick a team,...

Problem Recent Solvers624

Suggested Problems

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!