Is there a way to modify default function template
10 views (last 30 days)
Show older comments
When I use the New > Function button and name the created file it generates a default function code with the appropriate name. The generated function has 2 default input variables and output variables and some useless code copying the inputs to the output. Whenever I create a function like this I have two options
- Remove/rename the relevant sections of the function (input, output, code inside)
- Delete the entire function and type it out from scratch
Both options are annoying, especially doing it every time in a larger project. Is there a way to modify this default function creation. I would like to keep the matching names but rather have something like this
function [] = AssignedName()
end
5 Comments
John D'Errico
on 31 May 2021
Edited: John D'Errico
on 31 May 2021
Apparently, the idea is not one that has been deemed important enough to do something about. You can always submit an enhancement request. Surely, it does not take that much effort to select a block of text, and click on the delete key. Are you creating that many thousands of new files, that this is a serious problem? Personally, having written many thousands of m-files over the years, one would think it would drive me crazy, IF it was really an issue. Not so.
And really, the link that Geoff shows does provide a simple way to populate a new file as you like it. What about that is inadequate?
Answers (1)
See Also
Categories
Find more on Startup and Shutdown 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!