Added new test case 9 Oct. 2012
Are you missing some text from your example?
Test suggestion: Stick a zero in one of your v vectors and you'll eliminate some of the shorter answers.
Yes. All solutions with find don't work with 0 in v.
Thanks for the suggestions -- I updated the text, added a new test case and rescored.
@Nicholas Howe: The test suggestion meant: stick a 0 in v, and this 0 is meant to replace an entry of M that was unequal to 0. In other words: the new test-case doesn't make a difference (and hence is useless) if M is a null-matrix.
The cases with d=0 are working for me but your test cases are giving error..... What's this?
please, when you make use of test cases with floating point numbers specify a common precision, otherwise is impossible to pass the suite and people need to be noob! thx in advanced
Why does it fail Test #2?
Wouldn't work if d was undefined and M wasn't a diagonal matrix.
I like the try/catch with ans
It seems Matlab allows for many useful tricks. I was surprised at the behavior of 'diag' in the leading solution.
The Goldbach Conjecture, Part 2
Connect Four Win Checker
Flip the main diagonal of a matrix
Matrix indexing with two vectors of indices
03 - Matrix Variables 5
Fair Scoring for Cody
Cell Source Index
middleAsColumn: Return all but first and last element as a column vector
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office