主要内容

Results for


I already solved some problems in Cody, why does he not increase my points or allow me to earn badges?
I need to put a number of problems on MATLAB cody under same Problem group, as many other people have done.
Can anyone please help me on this.
I created a problem in Cody that approximates e. To test the user's solution, I compare their solution to e. What I want to do instead is compare the user's solution to my reference solution. The question is how do I call the reference solution in the test suite?
This is currently my test suite.
sol=exp(1);
y_correct = playgame();
assessVariableEqual('y_correct',sol);
I created several problems recently in CODY. Some of them got removed automatically. I was curious as to why.
It is possible that the problems used latex in their description, so I am not sure if that was the reason they got rejected by the cody server.
I created some problems last night and created a group too. All those are now missing.
Also my ranking progress, activites, badges earned last night are missing too.
Hi all,
I hope everyone is doing well and keeping safe. I was wondering, are there any Cody challenges for Simulink these days?
I saw a post from 2015 (https://blogs.mathworks.com/simulink/2015/08/07/modeling-and-simulation-challenge-in-cody/) and it seems there was a Simulink or "Modeling and Simulation Challenge" problem group, but I couldn't find this group anymore. Perhaps I missing something?
Thank you beforehand.
Tungky
I see this solution on the Cody solutions list. Solution 1949216
I am puzzled as to how this could possibly be rated as correct (size 48)
(BTW - I am pretty sure I saw this, or similar, before.)
function ans = fileread(varargin)
' ';
a=1;
b=3;
a=1;
b=3;a=1;
b=3;a=1;
b=3;a=1;
b=3; end
It's pretty odd how a solution that uses more characters than usual can be the "leading solution" of a Cody problem and have the least size. Compare these two codes that find the sum of integers from 1 to 2^x, which one uses fewer characters, thus should be the better solution?
function y = sum_int(x)
regexp '' '(?@y=sum(1:2^x);)'
end
function ans = sum_int(x)
sum(1:2^x)
end
If a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,...N i.e. the expected value of one die. For example, the expected value of a 6-sided die is 3.5.
Given N, simulate 1e8 N-sided dice rolls by creating a vector of 1e8 uniformly distributed random integers. Return the difference between the mean of this vector and the mean of integers from 1 to N.
function dice_diff = loln(N)
A=randi([1,N],1e8,1)
M=mean(A)
B=1:N
m=mean(B)
dice_diff =abs(M-m);
end
Here is my code, but it can't work out as it needs too long time to creat A.
In problem 16 I used the following solution:
function b = nearZero(a)
b = max(a(imdilate(a == 0, [1 1 1])));
end
It is working pretty well on mathlab but when I submit my answer to cody, the following error is generated:
Undefined function 'imdilate' for input arguments of type 'double'.
Error in nearZero (line 2)
b = max(a(imdilate(a == 0, [1 1 1])));
Error in Test1 (line 3)
assert(isequal(nearZero(a),b))
In number 5, its written that the correct answer is c = 1 but the secomnd person has more change than the first person, therefor the correct answer should be 2.Likewise in number 6.
Hi, I'm trying to solve this problem but I'm getting an error so far.
Problem:
Given a vector a, find the number(s) that is/are repeated consecutively most often. For example, if you have
a = [1 2 2 2 1 3 2 1 4 5 1]
The answer would be 2, because it shows up three consecutive times
What I've written so far (not done):
a = [1 2 2 2 1 3 2 1 4 5 1];
[x,y] = size(a);
counter = zeros(1,10);
if x == 1
for i=1:1:y
if a(i) == a(i+1)
counter(a(i)) = counter(a(i))+1
end
end
else
for i=1:1:x
if a(i) == a(i+1)
counter(a(i)) = counter(a(i))+1
end
end
end
But it says "error" in the line of "if a(i) == a(i+1)". I noticed that it creates a variable called "i" which value is 11, but it should create a vector from 1 to 11. What's wrong here?
I know my solution might not be in the right direction or something, but please don't tell me anything!
Thanks in advance
Dear Sir or Madam
I tried to solve the cody-problem namend in the title.
Could you pleas tell me how I should name the vektor/variable in which it should be presentet?
Thank you for helping me.
Yours faithfully
Jann Borlinghaus
I wrote a Cody problem, but I want to prevent people from using tricks to get a false "best" solution.
For example, many people do something like the following:
regexp '' '(?@"CODE HERE)';
in order to get the size of their program down to something quite small. I want to prevent this. I have seen people using some weird tests to try to block this, but I don't know how they work and when I try to copy them they fail.
Would it make sense that, in order to enhance coding experience with practice exercises, each section of the Matlab Academy courses reference specific CODY problems related to that section so the CODY problems can be used in parallel with the structure of the Matlab Academy courses?
I started with Cody today and I found the file calculateSize.m https://de.mathworks.com/matlabcentral/fileexchange/34754-calculate-size which should determine the size of my solution. Unfortunately I do not get it to run. Can someone explain this to me or maybe explain how exactly the size of the solution is calculated?
Something seems to either have changed with webread/urlread behavior with R2016a or the Cody site has changed its authentication after it's September 2016 upgrade. Now, when ever I make a call using either webread (with weboptions) urlread using "My Cody" url, I get the html that corresponds to an unauthenticated user.
I've tried passing credentials using weboption and also cached the credentials using the built in Matlab browser - neither helped in seeing the authenticated version of this page.
Any help in understanding where the problem/solution lies would be helpful. Easily reproduced by running...
URL = 'https://www.mathworks.com/matlabcentral/cody/players/1261697-gregory/solved';
[Contents Status] = urlread(URL);
Compare this to the source pulled down when authenticated with Chrome (for example, search for the work "two"). FYI: this has worked for a couple of years up until now...
O45
O45
Last activity 2018-10-23

Hi, I am uploading the answers to cody problems. Although most of answers are correct but my size is bigger than the best answer. How can I view the best answer?

Apologies for putting this question here, but I'm not sure there's a specific forum for Cody-related questions.

I recently noticed that a new badge for "Magic Numbers Master" had been created and awarded. When I entered my profile to check that out, I noticed that I had received that badge, but lost the badge for "Cody Challenge Master." I thought that maybe my solution had been messed up because of a change in one of the test suites that my solution missed, as this has happened a number of times on other problems. According to the text underneath the badge icon, I've still solved all 96 of the questions in the Cody Challenge. All of the problems listed as part of that challenge are still marked as "Solved." Has anyone else run into this issue?

I created a solution for Cody Problem 1745 (Get me!) that is very simple and works perfectly on my computer; but in Cody, it results in the error:
Error: Undefined function or variable 'me'.
The test code is:
get = me();
y = rand(1,12345);
!rm now.m
!rm assert.m
assert(get == now)
My solution is:
classdef me
methods
function tf = eq(obj,~)
tf = true;
end
end
end
Why doesn't Cody accept this?
(P. S.) And why doesn't it accept function definitions like
function justDoIt
(which are appropriate for some problems and accepted by MATLAB) but requires at least one input and output?