It's a little scary redefining mtimes this way! As soon as I solved it, I deleted the function.
Cody is not allowing overloading the built-in function mtimes.
am confused is overloading possible here or not?
It is not. I solved overwriting the function assessFunctionAbsence, which is not the goal of the problem. Within this function, I created a file that contained my solution f = fopen("mtimes.m", "w").
There are other problems in Cody with this same issue, but without a non-builtin function to overwrite. I've notified their creators and the Cody team, but sadly nothing was done so far. It's the weirdest thing since MATLAB does allow me to do it with a big warning nonetheless.
Imho, Authors should have a chance to update their problems, but if they don't, these problems should be deleted. Unless a problem deals with object-oriented programming, requiring overwriting is not promoting good programming practices. That's why MATLAB complains if we do it without classes.
To solve a lot of issues within Cody, a set of X different problems could run the reference solutions once by week or by month. If the reference solutions don't work, then authors are notified to update their problems within some fixed time period. There is no point to keep storing problems that are unsolvable and may be used by some authors for unsportive activities (which is not the case here). Deleted problems could even subtract points from everyone that solved them.
PS: Notice that this could even prevent people from posting their homework as a problem for people to solve when a working reference solution is obliged.
it seems like there is a bug here: how am I supposed to overload mtimes without using it? (assert failed here on all test saying: The function mtimes is a built-in MATLAB function. Please use a different function name.
)
I'm kind of hung up. function y=mtimes(a,b) works just fine on my computer running 2018a. However when used here, Cody gripes at me about using a different function name since mtimes is built in and fails me. Changing the name to something else (asdf, for instance) fails since I haven't modified mtimes to handle strings. What am I missing?
cheat!?
I thought this problem is no longer solvable since mtimes is a built-in function. There might be a way that I don't know of
@Asif, I see, sorry
Actually, this is not a correct solution. The else branch leads to infinite recursion.
Find all elements less than 0 or greater than 10 and replace them with NaN
13137 Solvers
1610 Solvers
1344 Solvers
6643 Solvers
Is this a valid Tic Tac Toe State?
103 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!