Is there a way to modify default function template
17 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
John D'Errico
le 31 Mai 2021
Modifié(e) : John D'Errico
le 31 Mai 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?
Réponses (1)
Voir également
Catégories
En savoir plus sur Function Creation dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!