We start with vector V. Some values W will be inserted into V, at positions U.
Say, V contains [1 2 3 4 5] and W is [0 -1] while U is [2 4], then the function should return as a result [1 0 2 3 -1 4 5]. In other words, the values at the positions in which a new value is inserted shift to the end of the vector. And the indices indicated in U are the original indices, when no elements have been inserted yet.
Insertion at position one-after-the-last element of v just appends that value to the vector v.
Your task is to find the most efficient or elegant solution to code this in Matlab language.
(Eval and Regexp are not your friends this time.)
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers34
Suggested Problems
-
6086 Solvers
-
Remove the small words from a list of words.
1560 Solvers
-
Return elements unique to either input
808 Solvers
-
Find the maximum number of decimal places in a set of numbers
3394 Solvers
-
ベクトル [1 2 3 4 5 6 7 8 9 10] の作成
601 Solvers
More from this Author31
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!