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?
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.
Encode Roman Numerals
Back to basics 15 - classes
Create a Multiplication table matrix...
Relative ratio of "1" in binary number
Produce a cosine wave
The Top 5 Primes
String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
Cody meets Xiangqi: foresee the unseen (Part 1)
Combine the first and last names
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