Is there a way to modify the default script when creating a new one from the "new" pulldown (generate script/function template)?
You can accomplish this workflow using the following steps:
1. Create a script “my_template.m” that has the layout of your code
>> % Description: >> % Author: Foo >> % Comment: >> close all; clear; clc
2. Create a function "make_fun.m" that utilizes "copyfile" function to copy the template to a new m-file
>> function  = make_fun(V) >> copyfile('my_template.m',V) >> edit(V)
3. From the command line, you can call "make_fun" function to create a new function/script with the name of your choice
This solution was originally provided in the following link: