The image processing toolbox is not available!
A fantastic 1... calculate based on d distance of each element 4m central 1...
I see that now Jan, this stinks!
I have a question about why I can't use bwdist to generate the chessboard matrix?
Image Processing ToolBox is not allowed?
good problem. What is use of this matrix?
Like this one!!
Had lots of fun figuring it out
Any one know how can you view a solution with lesser size than the one you submitted ?
never have the chance to see how people did it with less than 10 size
Solving another cody problem you will enable you to see all the solutions to a this problem, and so learning can take place :)
why does my solution work on matlab and not here?
Very challenging problem
Best problem out of those I solved till now.
I have tried using padarray. Its working totally fine with my MATLAB R2017b, but this shows undefined function. Why? Which version cody compiler is compatible with?
Simple Problem, but work out a lot for it, in the end I find the solution too simple. But great thing is I've learned a lot from it.
Nice problem. I like such matrix problems.
really enjoyed it
Adding comment for testing badges!!
A lot easier than I originally anticipated. Once you start setting up the problem variables, it comes together pretty easily.
nic problem..it was fun
function a = bullseye(n)
a = 1;
for i = 2:(n+1)/2
a = padarray(a, [1,1], i, 'both');
Why doesn't this function work?
That's probably because padarray() needs Image Processing Toolbox which is not implemented in Cody.
Wow, this wasn't easy for me
Should be the best for now!
nice! didn't know about discretize til i saw this solution
This is the actual, sans regexp, size of the leading solution: 25
The ans is amazing.Contrast to my last solution,the size add 2.
This solution is from online froum.
my solution clearly works on my matlab. not here. wonder why
Shame you can't use padarray.
it's very nice solution, but sadly it's not general solution
My original objective was to reduce the Cody size as much as possible. You can make this solution general by using y = discretize(spiral(n), [0 1:2:n].^2+.5) or y = discretize(spiral(n), [0 1:2:n].^2, 'IncludedEdge','right'), which has a higher size though.
I checked the above function against the two cases below and it produces correct result yet the test shows failed. I think the test is broken.
"padarray" is not allowed to use in sever.that's why.
more elegant solution than a loop: Use the LDL decomposition on the bullseye matrix and you will find an interesting L and D matrix. THe D matrix is diagonale and can be built using n only. THe matrix L is the sum of a lower triangular matrix whose lowest part is put to zero using the mirrored triangular matrix. Finally the identity matrix is added :)
hehe cheeky alert
Perhaps a little pointless just reproducing the test case?
no image processing toolbox then?
:P yeah, I know...
Very nice, well done.
Not exactly a general solution...
This would work if it recognized 'padarray'. Is cody using an older or more spartan version of matlab?
Solutions like this are tricky. It would be nice if we could all agree as a community that this is not a valid way to reduce the size of a solution.
Not fair :(
Project Euler: Problem 1, Multiples of 3 and 5
Find a subset that divides the vector into equal halves
Output any real number that is neither positive nor negative
2倍してみよう - ここからスタート！
Perimeter of a semicircle
Remove the small words from a list of words.
Who Has the Most Change?
Which values occur exactly three times?
Find the alphabetic word product
Find the treasures in MATLAB Central and discover how the community can help you!
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