Problem 2010. Wrap a vector, but insert NaN's at the wrap-positions.
Solution Stats
Problem Comments
-
3 Comments
a couple of issues: 1) I believe you are missing the input 'm' to wrapnan in your testsuite; 2) some numerical precision issues arise in the last test (e.g. rem(.8,.5)-.3 returns ~.5e-17), perhaps you could just round to two decimals the output of wrapnan so that we do not have to?
I fixed it. Thank you for reminding me. You might submit a shorter solution now.
I am still determining what's happening in the third case. A NaN is inserted before 1.40 but not before 1.50, which is a multiple of 0.50? The difference between 1.80 and 1.40 is 0.4, not 0.5 either...so what's going on? Every time we crossed a multiple of a factor m going up or down, a NaN should have been inserted. Imho, the problem is unclear about what should be done or the 3rd test is wrong. Maybe a sketch would help.
Solution Comments
Show commentsProblem Recent Solvers20
Suggested Problems
-
Find the numeric mean of the prime numbers in a matrix.
9059 Solvers
-
2506 Solvers
-
Convert a numerical matrix into a cell array of strings
2256 Solvers
-
String substitution, sub problem to cryptoMath
238 Solvers
-
Arrange vector in ascending order
798 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!