Given n, odd number > 1, return n by n matrix consist of "null" and "*" characters arranged like a diamond.
No toolbox functions please.
n = 3
n = 7
may I suggest reinforcing your test suite using isequal or strcmp to hardcoded diamond strings?
why is the first test showing error while others passing :
assert(all(find(double(make_diamond(3)) == 0) == [1 3 5 7 9]') == 1)
Matrix dimensions must agree. Error in Test1 (line 4) assert(all(find(double(make_diamond(3)) == 0) == [1 3 5 7 9]') == 1)
what is this supposed to mean? Am I missing something?
Sorted highest to lowest?
Is my wife right?
Max index of 3D array
Who has power to do everything in this world?
Subtract two positive numbers
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