image thumbnail

Open new editor window with template / header information

by

 

This file opens a new window in the editor and prefills it with some template or header information.

NewFile_with_Header
%% #######################     HEADER START    ############################
% 
% HERE COULD BE SOME LICENSE INFORMATION, PRIVACY, CONFIDENTIAL LEVEL, DISCLAIMER, ...
%
%*************************************************************************
%
% Filename:				NewFile_with_Header.m
%
% Author:				Dr. A. Mering
% Created:				01-Nov-2012
%
% Changed on:			XX-XX-XXXX  by USERNAME		SHORT CHANGE DESCRIPTION
%						XX-XX-XXXX  by USERNAME		SHORT CHANGE DESCRIPTION
%
%*************************************************************************
%
% Description:
%		This function creation an template with some prefilled fields and
%		opens the template in the editor.
% 
%
% Input parameter:
%		- none
%		- none
%
% Output parameter:
%		- none
%		- none
%
%*************************************************************************
%
% Intrinsic Subfunctions
%		- none
%
% Intrinsic Callbacks
%		- none
%
% #######################      HEADER END     ############################

%% #######################    FUNCTION START   ############################
function NewFile_with_Header

% define creator name
switch getenv('USERNAME')
	
	case 'case1'
		user_string = 'Department1 / User1';
		
	case 'case2'
		user_string = 'Department2 / User2';
		
	case 'case3'
		user_string = 'Department3 / User3';
		
	case 'case4'
		user_string = 'Department4 / User4';

		
	otherwise
		user_string = 'REPLACE';
end

% define header and function head
template = sprintf('%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s%s\n%s%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n%s\n',...
		'%% #######################     HEADER START    ############################',...
		'% ',...
		'% HERE COULD BE SOME LICENSE INFORMATION, PRIVACY, CONFIDENTIAL LEVEL, DISCLAIMER...',...
		'%',...
		'%*************************************************************************',...
		'%',...
		'% Filename:				NAME.m',...
		'%',...
		'% Author:				', user_string,...
		'% Created:				', date,...
		'%',...
		'% Changed on:			XX-XX-XXXX  by USERNAME		SHORT CHANGE DESCRIPTION',...
		'%						XX-XX-XXXX  by USERNAME		SHORT CHANGE DESCRIPTION',...
		'%',...
		'%*************************************************************************',...
		'%',...
		'% Description:',...
		'%		PLEASE_FILL',...
		'% ',...
		'%',...
		'% Input parameter:',...
		'%		- input_arg1:		DESCRIPTION',...
		'%		- input_arg2:		DESCRIPTION',...
		'%',...
		'% Output parameter:',...
		'%		- output_arg1:		DESCRIPTION',...
		'%		- output_arg2:		DESCRIPTION',...
		'%',...
		'%*************************************************************************',...
		'%',...
		'% Intrinsic Subfunctions',...
		'%		- subfunction1',...
		'%',...
		'% Intrinsic Callbacks',...
		'%		- callback1',...
		'%',...
		'% #######################      HEADER END     ############################',...
		'',...
		'%% #######################    FUNCTION START   ############################',...
		'function output_args = FUNCTIONNAME(input_args)',...
		'',...	
		'',...
		'% #######################     FUNCTION END    ############################',...
		'',...
		'%% #######################  SUBFUNCTION START  ############################',...
		'',...
		'',...
		'% #######################   SUBFUNCTION END   ############################',...
		'',...
		'%% #######################    CALLBACK START   ############################',...
		'',...
		'',...
		'% #######################     CALLBACK END    ############################',...
		'');
	
	
% Put to Matlab editor
com.mathworks.mlservices.MLEditorServices.getEditorApplication.newEditor(template);

% #######################     FUNCTION END    ############################

%% #######################  SUBFUNCTION START  ############################


% #######################   SUBFUNCTION END   ############################

%% #######################    CALLBACK START   ############################


% #######################     CALLBACK END    ############################

Contact us