Is it allowed to publish an extension to a built-in function on File Exchange?

1 次查看(过去 30 天)
I have a great idea for additional functionality of a built-in function from a MATLAB toolbox. For this extension to work, I'd need to use almost the entire original function's code and add my functions to it. Is this allowed?
The function in question needs other functions from the same toolbox, so my extension would not work for others without the toolbox. However, I'm still copying many lines of original MATLAB code. Is this allowed?

回答(4 个)

Walter Roberson
Walter Roberson 2016-7-27
If you take a Mathworks function and modify it and post the new function, that would be a violation of copyright. Only people who have the appropriate toolbox are authorized to look inside at the .m, but posting on File Exchange would make that code available to the public including to people who have no MATLAB licenses at all.
  3 个评论
Stephen23
Stephen23 2016-7-28
编辑:Stephen23 2016-7-28
@Erik: From the FEX startpage:
  1. click "About File Exchange" (LHS, below "Submit a File" button)
  2. click "MATLAB Central Terms of Use" (RHS top).
  3. click "File Echange"
will get you here:
which explains that all FEX submissions are licensed under the BSD license. Is MATLAB code itself licensed under the BSD ? No.
However it is up to MATLAB to decide what license they have given you: this is their right, and it may be different between customers.
Erik
Erik 2016-7-28
Thanks. The terms also specify that I must be the rights owner of anything I publish, which is not the case for any part of a built-in MATLAB (toolbox) function. I'll contact support with my question and suggest I could publish it, but this is probably not allowed. Maybe they'll add it to their enhancements list, as Steven Lord has commented below.

请先登录,再进行评论。


Steven Lord
Steven Lord 2016-7-27
I would recommend contacting Technical Support and/or Customer Service. They will be able to give you a definitive answer, plus if you describe the enhancement you want to make they may indicate it's already implemented in a later release than the one you have or may describe a way to achieve the same results using existing tools.
If it's not possible to do that already, they can enter your description into the enhancement database. Once it's in the enhancement database, the development staff can consider implementing the enhancement request in a future release of the toolbox.

Image Analyst
Image Analyst 2016-7-27
Yes, it's allowed. For example I use the entire code of imshow(), imread(), and many other functions in my File Exchange submissions. For example my Image Segmentation Tutorial does image segmentation, like the built in functions im2bw() and regionprops() do, but it does so much more, while using those functions inside mine. The File Exchange would have hardly any functions in it if people weren't allowed to use built-in function in them. Of course I mean calling the built-in functions, since none of use have code for the internals of those functions, unless you're a Mathworks employee.
  3 个评论
Image Analyst
Image Analyst 2016-7-27
Most m-files in the toolboxes don't have very much stuff in them before they end up calling a DLL or some binary code. So you're not really going to have source code for toolbox functions. And using code built from intact toolbox functions to derive other functions is allowed - every File Exchange submission does that. Sure, he's not allowed to reverse engineer code to try to get the original code but I don't think he'd be able to do that. He says he needs/wants to use "the entire original function's code" ... but I don't think he'd be able to get to that. He can only get to the code at the function call level so I assume that's what he meant. If he does indeed have a way to get to the original source code that normally only Mathworkers have access to, then I think he should say so, but I don't think that's the case.
Erik
Erik 2016-7-28
编辑:Erik 2016-7-28
For example, look at the code of fft2.m: it is merely a layer on top of fftn.m and fft.m. If I want to insert functionality, e.g. I put a line of code somewhere in between the other code in fft2.m, depending on that point in the function, then I'd need to reuse and publish the contents of fft2.m with my own code within it. In other words: I can't simply call fft2.m from my own function, I really need to change it. Also, I'd give it a different name to preserve the original functionality. For the sake of the example let's call it fft2e.m
By publishing fft2e.m I'm publishing all the code from fft2.m. However, this does not contain a fully functional fft2.m: it needs other parts of the signal processing toolbox (fftn.m and fft.m). It does contain copyrighted code from the toolbox, although not functional.
Would it be allowed to publish fft2e.m the way I describe it?

请先登录,再进行评论。


Erik
Erik 2016-7-28
编辑:Erik 2016-7-28
In the meantime I could solve the problem as follows, which is allowed I believe:
At the point(s) where I want to insert code into MATLAB's toolbox function, I could shadow the next function being called. In the example I give in a previous comment, I could want to insert some functionality into fft2.m at the point where fft is called. Suppose my extension to fft2.m is called fft2e.m. I could shadow fft by writing a function called fft.m containing the following pseudocode.
function varargout = fft(varargin)
% check who is calling fft.m
stack = dbstack;
if the last callers in stack are 'fft2' and 'fft2e' % you could even check the line number in fft2.m or the contents of its workspace
do the extended functionality to add to fft2.m before it calls fft
end
% return the output of MATLAB's built-in fft
[varargout{:}] = builtin('fft',varargin{:})
A requirement for this would be that the function you want to inject code into calls to a function at a specific point, so it can be shadowed.
The result is a function that doesn't use any code from MATLAB's proprietary function. However, the methods used to inject my own code might be error-prone. It also makes every other call to fft quite inefficient, as it needs to check if fft2 and fft2e are the caller.
Do you know of a more robust solution without making changes in a MATLAB function file itself?

类别

Help CenterFile Exchange 中查找有关 Manage Products 的更多信息

标签

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by