how to contribute a new func/algorithm?

3 views (last 30 days)
Hi, If we have a new algorithm, and would like to implement a new function so everyone can use it, how can we contribute it to Matlab? For example, we name it fzero4large, people can type fzero4large(....) and get answers.

Accepted Answer

John D'Errico
John D'Errico on 13 Feb 2011
If by "everybody", you mean all of your friends who use MATLAB, you need to put it someplace where they can all put it on their search path. They would use the pathtools in MATLAB to add that given directory to their search path, and now they will be able to see your code in MATLAB.
If by everybody, you want your function to become part of MATLAB proper, this is not possible unless you work for TMW and can convince them that your code is worth such an effort.
If you mean that your function will become available to anyone who wants to download it for free, then the file exchange can be a good place, IF you do a few things first.
Please do us all a favor though, DOCUMENT your code. Make is a useful tool that others can use and will want to use. Don't just submit your homework assignment because you got an A on it. Follow standard styles for documentation, and for interaction with the user. Don't use the input command for command line input. Do provide a function that someone can call, rather than a script that begins with the words "clear, clc, close all". Your instructor may want that, but NOBODY else who will want to use your stuff in the real world does, and the file exchange is for real world use.
Make your code robust to problems. Test it well. Provide error checking that will let it survive, returning a meaningful error dialog to help the user understand what they did wrong or what went wrong. Use good numerical techniques, that show you understand the arcane and abstract art of numerical analysis where that is necessary.
If you wish for examples of programming style, look at the tools in MATLAB itself. Emulate their help styles. Or look on the FEX for codes that earn high compliments from professionals. Read the comments and see what factors do make for useful tools.
All of these things make for a useful contribution to the world. I'm not saying that you must do everything I said above. But if you want others to find your work useful, then the above things are ways to help them do their work. And everybody wants to find something to make their lives a bit easier.
  2 Comments
Steven Lord
Steven Lord on 24 Jun 2015
One comment on John's excellent answer: convincing us that your function would be a good addition to MATLAB doesn't require that you work for MathWorks (though it helps.) You could contact Technical Support and request that they enter your request in the enhancement database. It is still a high bar, but not quite as high a bar as our interview process :)

Sign in to comment.

More Answers (1)

Walter Roberson
Walter Roberson on 13 Feb 2011
You could contribute it to the Matlab File Exchange . That will not make it part of the product, but will make it available for free download.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!