Am I allowed to write functions that have names of matlab functions (copyright)?
Show older comments
Hello everyone,
I am not really well versed when it comes to copyright laws. My question is, am I allowed to write a function and give it a name that exists as a Matlab function, for example from a toolbox? Am I allowed to share said functions?
I know that the code within a Matlab supplied function is copyrighted and is property of Matlab, but does this hold also for the names of the functions? For example, may i write my own function, which is called "mvnrnd.m"? Am I allowed to share such a function with someone else?
I can't imagine it would be, since I can have that function name in another coding language and i don't see how Mathworks can sue the other company for something so generic, but I prefer to ask anyways.
I am leaving aside the obvious coding issue if you have two functions with the same name.
11 Comments
I don't see that the function names are/can be copyright, but I am not a lawyer and this is not legal advice. I would question the benefits to doing this though: there are more disadvantages than advantages to using the same name as inbuilt functions. Your function is unique, so why not give it a unique name?
For a longer discussion on this topic:
Rik
on 23 Jun 2018
I'm not a lawyer either.
There is one aspect different here: Boris Blagovs function is aimed at having the exact same functionality. The other reasons for choosing your own name still apply, so in sum total I would still suggest you pick your own name. In some of my functions I use my own extension of regexp to provide backward compatibility. Using your own function name will help in such cases as well.
Walter Roberson
on 23 Jun 2018
Edited: Walter Roberson
on 23 Jun 2018
If the functions are intended to have the same functionality as Mathworks functions, then distribution rights requires careful reading of the Mathworks license, which in at least some circumstances specifically do not permit that. And that applies even if you do not use the same function names.
Boris Blagov
on 25 Jun 2018
Rik
on 25 Jun 2018
The thread Stephen linked did not apply to the copyright question, but to the intention of using the same name. Can you absolutely guarantee that your function will behave the same, in every possible edge case? Your function is your function. With it's own name, it's easier to take credit for it, easier to find, and easier to spot for users that it might not have the same result as the builtin, especially for edge cases.
Boris Blagov
on 25 Jun 2018
Walter Roberson
on 25 Jun 2018
If you are deliberately doing it so that someone can avoid purchasing a toolbox, then it is not permitted by the Mathworks license.
Writing routines with similar names to Mathworks functions but which extend functionality by operating on a different class of data is permitted. For example writing a mvrnd() that operates over a field of Gaussian rationals would be permitted.
Boris Blagov
on 25 Jun 2018
Edited: Boris Blagov
on 25 Jun 2018
Adam
on 25 Jun 2018
The main reason you get answers related to whether or not it is a good idea to do it or not is that you are asking a question on a general Matlab forum that cannot possibly be answered by a general Matlab Answers visitor. If you want an answer that carries legal weight you have to ask a lawyer or ask Mathworks directly. Even on the off-chance that a lawyer who happens to be well versed in this exact part of the law happens to also work with Matlab and be browsing the forums would you trust their word that they are in fact a person with such knowledge just because they say so?!
So yes, threads like this will often end up as a hazy general discussion on why you probably wouldn't want to do it and all the various pros and cons.
Boris Blagov
on 25 Jun 2018
Walter Roberson
on 25 Jun 2018
Mathworks does not permit its staff to give public interpretations of the license terms, except in the form of occasional "Solutions" posted under the Mathworks Support account. The correct avenue is to contact either Technical Support or Sales with specific scenarios.
Actual lawyers not working for Mathworks do not comment on these kinds of situations without a lot of talk about jurisdiction -- and talk about the difference between what the law says and what the case law is in that particular jurisdiction.
Accepted Answer
More Answers (4)
Jan
on 25 Jun 2018
There have been reports in this forum about cases, in which using the name of a toolbox function without having a license for this toolbox, caused an error during the folder is included in the path - before the function is used. So beside the legal issues, there could be a restriction in the software.
I've shared a larger program with another lab, which did not have the Signal Processing Toolbox. It was used in my code only for a Butterworth filter. I've rewritten a function to calculate the filter parameters from scratch without taking a look into the original function to be sure. Now I'm using this workaround:
function vargargout = myButter(varargin)
persisent butterFcn
if isempty(butterFcn)
if ~isempty(which('butter.m'))
butterFcn = @butter;
else
butterFcn = @local_butter;
end
end
[varargout{1:nargout}] = butterfcn(varargin{:});
end
function [Z, P, G] = local_butter(n, W, pass)
...
end
Now Matlab's version is used, if it is available, and my one otherwise. This does not compete with Matlab's Signal Processing Toolbox. But if I write replacements of all functions of this toolbox and offer it commercially, I'd expect troubles.
1 Comment
Boris Blagov
on 25 Jun 2018
Edited: Boris Blagov
on 25 Jun 2018
Jan
on 23 Jun 2018
0 votes
The names of the function are not covered by a copy right. Of course, they are not: imagine the built-in functions "i" and "j".
But it will be a bad idea to call your function like built-in functions of Matlab's toolboxes. Shadowing the built-in functions can cause serious troubles. After an experiment with a user-defined and buggy version of strcmp, my Matlab installation could not be used anymore: There was no chance to modify the path or to open the file for editing. I had to use an external editor to fix this.
It is very hard to guarantee that there are no collisions between user-defined and Matlab's functions. If you do not own all toolboxes or future versions of Matlab contain new functions, there is no chance to check this. You can use FEX: UniqueFuncNames to check at least the locally defined functions.
4 Comments
Boris Blagov
on 25 Jun 2018
Jan
on 25 Jun 2018
@Boris: If MathWorks has published a function, whose name you used before, did you accuse them to break your copy right? Of course not. But if they copied the source from your function, this would be a problem.
Some years ago I've improved the processing speed of the toolbox function filtfilt.m by modifying some lines of code. I did not publish the patched function, but a tool to modify the existing file on the machine of the user. I asked MathWorks, if this is a conflict with the Terms of Use, paragraph 2. iii:
Content that you submit must not directly compete with products
offered by MathWorks.
Is improving the same as competing? The MathWorks accepted my code. The new version of filtfilt uses equivalent methods now.
So if you want a really trustworthy answer, contact MathWorks directly.
Boris Blagov
on 25 Jun 2018
Walter Roberson
on 25 Jun 2018
Boris, you mentioned that you are in the EU. The entire EU has signed copyright treaties such that "sufficiently original" works are automatically copyrighted at the moment of creation, without any need to register the copyright. Registering the copyright might extend the legal protections available (depending on jurisdiction), but in any jurisdiction that has signed the treaties, the item is copyrighted upon creation even without registration.
Image Analyst
on 23 Jun 2018
0 votes
The names are not copyrighted. I even know of some functions, skewness() and dataset(), that are being sold by a commercial company. Mathworks knows about that situation. There's no problem, other than being the MAJOR problem that you "put aside".
1 Comment
Boris Blagov
on 25 Jun 2018
John D'Errico
on 25 Jun 2018
0 votes
I am not a lawyer. But I would argue that it is the code that matters, and the code that has a copyright, which will reside in that code. The name of the function is not covered though. It cannot be. If anything, the name of a function might involve a question of trademark. But that is not the case. You will not find trademarks on the names of functions.
So you can distribute your own version of mvnrnd. It is arguably a poor idea, since your version of that code may well not be coded as well. And if it has subtly different functionality than the one that is supplied by MathWorks then you may be creating subtle bugs inside the code of those who use MATLAB and who have been given your code, possibly without knowing what was done. Such a bug could be difficult to track down.
1 Comment
Boris Blagov
on 25 Jun 2018
Categories
Find more on Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!