I strongly suggest you read the "What Makes a Good Problem?" section on http://www.mathworks.com/matlabcentral/anniversary/triathlon_guidelines. Please pay attention to the second guideline: It should have more than one test point.
The problem title and description have been improved and the test suite expanded.
Link from Peng Liu's comment has been down for several days. However the advice is still valid: Test Suites should include at least four test cases — although more are often necessary to prevent hard-coded workarounds.
Thanks to goc3 for improving the Test Suite and fixing the other issues. Those people interested in developing their own test suites might like to try the series of problems starting with https://www.mathworks.com/matlabcentral/cody/problems/44631
Find all elements less than 0 or greater than 10 and replace them with NaN
13046 Solvers
Back to basics 9 - Indexed References
392 Solvers
Number of 1s in a binary string
2818 Solvers
2453 Solvers
Matlab Basics - Convert a row vector to a column vector
419 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!