Problem 42480. Go back n times
You will be given a column vector (such as x = [1; 2; 3; 4; 5; 6]). If (n=3) you will return following;
[ 1 NaN NaN NaN 2 1 NaN NaN 3 2 1 NaN 4 3 2 1 5 4 3 2 6 5 4 3 ]
Solution Stats
Problem Comments
-
4 Comments
I imagine you are going to need to use "isequalwithequalnans" in your testsuite instead of "isequal" for this problem
Now, I have changed the assert statement
Example is wrong. Input vector x must be
x = [1; 2; 3; 4; 5; 6]
not
x = [1; 2; 3; 4; 5; 6; 7; 8]
Thanks Massimo. Changed it
Solution Comments
Show commentsProblem Recent Solvers43
Suggested Problems
-
Find all elements less than 0 or greater than 10 and replace them with NaN
15467 Solvers
-
middleAsColumn: Return all but first and last element as a column vector
599 Solvers
-
The sum of the numbers in the vector
589 Solvers
-
Matlab Basics - Switching Assignments
272 Solvers
-
Test Problem; Create a 5x5 array containing all ones
379 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!