Code covered by the BSD License  

Highlights from
addcopyright

5.0

5.0 | 1 rating Rate this file 3 Downloads (last 30 days) File Size: 3 KB File ID: #3949

addcopyright

by Raymond Norris

 

11 Sep 2003 (Updated 12 Sep 2003)

Add copyright information to M-file.

| Watch this File

File Information
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)')

Acknowledgements
This submission has inspired the following:
addcopyright
MATLAB release MATLAB 6.5 (R13)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
21 Dec 2004 Fu-Sung Wang

Great work!! I like it very much.

19 Mar 2007 David Little

Please cleanup the Description! Thanks.

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
copyright permission agreement Raymond Norris 22 Oct 2008 07:07:29
miscellaneous Raymond Norris 22 Oct 2008 07:07:30
utilities Raymond Norris 22 Oct 2008 07:07:30

Contact us at files@mathworks.com