Home > mrg > MRG_utilities > mrg_newfunc.m

mrg_newfunc

PURPOSE ^

Prompts for a new function name and location, and creates a MATLAB '.m'

SYNOPSIS ^

function mrg_newfunc

DESCRIPTION ^

 Prompts for a new function name and location, and creates a MATLAB '.m'
 with pre-filled (boilerplate) text for documentation.

 INPUT
   None. No input required.

 OUTPUT
   No output at console. Generates a file with pre-filled (boilerplate)
   text for function construction.  

 NOTES
   This function is intended to aid in the development of functions for
   the MRG toolbox by providing boilerplate text for important
   documentation.  

 AUTHORS
   Daniel Pritchard

 LICENCE
   Code distributed as part of the MRG toolbox from the Marine Research
   Group at Queens University Belfast (QUB) School of Planning
   Architecture and Civil Engineering (SPACE). Distributed under a
   creative commons CC BY-SA licence, retaining full copyright of the
   original authors.

   http://creativecommons.org/licenses/by-sa/3.0/
   http://www.qub.ac.uk/space/
   http://www.qub.ac.uk/research-centres/eerc/

 DEVELOPMENT
   v 1.0   2013-08-15
           First version. DP.
           Documentation. DP.
           corrected typos... BE

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function mrg_newfunc
0002 % Prompts for a new function name and location, and creates a MATLAB '.m'
0003 % with pre-filled (boilerplate) text for documentation.
0004 %
0005 % INPUT
0006 %   None. No input required.
0007 %
0008 % OUTPUT
0009 %   No output at console. Generates a file with pre-filled (boilerplate)
0010 %   text for function construction.
0011 %
0012 % NOTES
0013 %   This function is intended to aid in the development of functions for
0014 %   the MRG toolbox by providing boilerplate text for important
0015 %   documentation.
0016 %
0017 % AUTHORS
0018 %   Daniel Pritchard
0019 %
0020 % LICENCE
0021 %   Code distributed as part of the MRG toolbox from the Marine Research
0022 %   Group at Queens University Belfast (QUB) School of Planning
0023 %   Architecture and Civil Engineering (SPACE). Distributed under a
0024 %   creative commons CC BY-SA licence, retaining full copyright of the
0025 %   original authors.
0026 %
0027 %   http://creativecommons.org/licenses/by-sa/3.0/
0028 %   http://www.qub.ac.uk/space/
0029 %   http://www.qub.ac.uk/research-centres/eerc/
0030 %
0031 % DEVELOPMENT
0032 %   v 1.0   2013-08-15
0033 %           First version. DP.
0034 %           Documentation. DP.
0035 %           corrected typos... BE
0036 %
0037 
0038 %%
0039 [fname,fpath] = uiputfile('*.m', 'Enter a name and location for the function', 'mrg_FUNC_NAME.m');
0040 
0041 bptext = ['function [OUT1, OUT2] = %s(IN1, IN2)\r\n',...
0042 '%% DESCRIPTION. What does the function do?\r\n',...
0043 '%%\r\n',...
0044 '%% -- Read and Delete -- \r\n',...
0045 '%% Please fill out the description line above and the sections below. At a\r\n',...
0046 '%% minimum please document the INPUT and OUTPUT sections. If additional\r\n',...
0047 '%% sections headings are justified (e.g WARNING) please add these too.\r\n',...
0048 '%% -- Ends --\r\n',...
0049 '%%\r\n',...
0050 '%% INPUT\r\n',...
0051 '%%   IN1   DESCRIPTION\r\n',...
0052 '%%   IN2   DESCRIPTION\r\n',...
0053 '%%\r\n',...
0054 '%% OUTPUT\r\n',...
0055 '%%   OUT1  DESCRIPTION\r\n',...
0056 '%%   OUT2  DESCRIPTION\r\n',...
0057 '%%   If no output please state: NO OUTPUT AT CONSOLE\r\n',...
0058 '%%\r\n',...
0059 '%% USAGE\r\n',...
0060 '%%   Provide an example to show how the function should be used\r\n',...
0061 '%%\r\n',...
0062 '%% NOTES\r\n',...
0063 '%%   Additional (more verbose) documentation can go here.\r\n',...
0064 '%%\r\n',...
0065 '%% REQUIREMENTS\r\n',...
0066 '%%   List external toolboxes, platform dependencies etc here.\r\n',...
0067 '%%   If external toolboxes are needed, please provide links and state what\r\n',...
0068 '%%   version was used for development and testing.\r\n',...
0069 '%%\r\n',...
0070 '%% OCTAVE COMPATIBILITY\r\n',...
0071 '%%   If your code is Octave compatible? Yes, No, or Untested.\r\n',...
0072 '%%\r\n',...
0073 '%% REFERENCES\r\n',...
0074 '%%   Please list references here in a consistent, human readable format.\r\n',...
0075 '%%\r\n',...
0076 '%% AUTHORS\r\n',...
0077 '%%   YOUR NAME HERE!\r\n',...
0078 '%%\r\n',...
0079 '%% LICENCE\r\n',...
0080 '%%   Code distributed as part of the MRG toolbox from the Marine Research\r\n',... 
0081 '%%   Group at Queens University Belfast (QUB) School of Planning\r\n',... 
0082 '%%   Architecture and Civil Engineering (SPACE). Distributed under a\r\n',...
0083 '%%   creative commons CC BY-SA licence, retaining full copyright of the\r\n',...
0084 '%%   original authors.\r\n',...
0085 '%%\r\n',...
0086 '%%   http://creativecommons.org/licenses/by-sa/3.0/\r\n',...
0087 '%%   http://www.qub.ac.uk/space/\r\n',...
0088 '%%   http://www.qub.ac.uk/research-centres/eerc/\r\n',...
0089 '%%\r\n',...
0090 '%% DEVELOPMENT\r\n',...
0091 '%%   v 1.0   YYYY-MM-DD\r\n',...
0092 '%%           First version. INITIALS\r\n',...
0093 '%%\r\n',...
0094 '%% TODO\r\n',...
0095 '%%   LIST\r\n',...
0096 '%%\r\n',...
0097 '%%\r\n',...
0098 '%%%% Function Begin!\r\n',...
0099 '\r\n',...
0100 '\r\n',...
0101 '\r\n',...
0102 'end\r\n'];
0103 
0104 fileID = fopen([fpath, fname],'w');
0105 funcname = fname(1:end-2);
0106 fprintf(fileID,bptext,funcname);
0107 fclose(fileID);
0108 
0109 edit([fpath, fname])
0110 
0111 end
0112

Generated on Thu 29-May-2014 21:29:53 by m2html © 2005