| Description |
%ADDCOPYRIGHT Add copyright info to M-file.
% ADDCOPYRIGHT(ORGANIZATION) adds the copyright info to all M-files in
% the current folder as well as subfolders. The copyright year is the
% current year as a default. The organization is set to ORGANIZATION.
%
% The copyright line that is built up looks like the following:
%
% % Copyright <YEAR> <ORGANIZATION>
%
% For example:
%
% % Copyright 2003 The MathWorks, Inc.
%
% The copyright info is place directly above the Revision line.
% Specifically is it looking for the following substring:
%
% % $Revision
%
% Where the comment character is placed in the first column. If it
% can't find the $Revision keyword (Typically this is right after the
% help section of the M-file. See this file as an example), it doesn't
% know where to insert it. When it is finished, it will look like the
% following example:
%
% % Copyright 2003 The MathWorks, Inc.
% % $Revision...
%
% ADDCOPYRIGHT(ORGANIZTIONS,FOLDER) adds the copyright info to all
% M-files in the folder FOLDER and its subfolders. The copyright year
% is the current year as a default. The organization is set to
% ORGANIZATION.
%
% ADDCOPYRIGHT(ORGANIZATION,FOLDER,COPYRIGHT_YEAR) adds the copyright
% info to all M-files in the folder FOLDER and its subfolders. If
% FOLDER is [], the default value, the current folder (pwd), is used.
% The copyright year is set to COPYRIGHT_YEAR. COPYRIGHT_YEAR may
% either be a character string (for example, '2003' or '2001-2003') or
% a numeric. The organization is set to ORGANIZATION.
%
% ADDCOPYRIGHT(...,UPDATE) updates the copyright info if UPDATE is set
% to true (false by default). If FOLDER is [], the default value, the
% current folder, is used. If COPYRIGHT_YEAR is [], the default value,
% the current year, is used.
%
% When replacing the copyright info line, it looks for the following string:
%
% % Copyright
%
% Where the comment character is placed in the first column.
%
% ADDCOPYRIGHT([],FOLDER,[],UPDATE,COPYRIGHT_STRING) ignore the
% organization and the copyright year to build up a copyright string
% and use COPYRIGHT_STRING instead.
%
% Examples:
% ---------
% % Supply just the organization name, starting from the current
% % folder, and use the current year but don't overwrite it if the
% % copyright info is already there.
% addcopyright('My Organization')
%
% % Supply the organization name starting from the "src" folder (found
% % in the current folder), and use the current year but don't
% % overwrite it if the copyright info is already there.
% addcopyright('My Organization','src')
%
% % Supply the organization name starting from the "src" folder (found
% % in the current folder), and use the supplied year but don't
% % overwrite it if the copyright info is already there.
% addcopyright('My Organization','private',2001)
% addcopyright('My Organization','src','2001-2003')
%
% % Supply the organization name starting from the "src" folder (found
% % in the current folder), and use the supplied year. If the
% % copyright info is already in the M-file, replace it with the new
% % copyright line.
% % overwrite it if the copyright info is already there.
% addcopyright('My Organization','src',2004,true)
%
% % Replace all instances of the copyright info or add it if it's not
% % there. Use the supplied copyright info.
% addcopyright([],[],[],true, ...
% 'Copyright 1984-2003 MathWorks, makers of MATLAB(R)') |