function newsl(mdlName)
% NEWSL generate a New Simulink Model with corresponding name and opens it
%
% NEWSL creates and open a new Simulink Model having User specific
% pre-settings, like MATLAB and Simulink created Version in the Model
% History. Also creation Day and Hour, so you are able to track the root
% of the Model.
%
% NEWFCN, NEWSL, NEWXPC and NEWFCN_RENAME are a set of M-Functions which
% shold help the MATLAB User to create Functions, Simulink and xPC Target
% based Models in a quick Way.
% It starts or brings to front the Simulnk Library Browser to start
% building your Model.
%
% These Files are shared for all Users in :
% http://www.mathworks.com/matlabcentral/fileexchange
%
% Syntax: >> newsl('NewModel') or >> newsl NewModel
%
% See also: NEWXPC NEWFCN NEWFCN_RENAME
%% AUTHOR : Frank Gonzalez-Morphy
%% $DATE : 11.-April-2001$ + UPDATED: $ 26-Jul-2004 00:41:19 $
%% $Revision : 1.21 $
%% DEVELOPED : (R12.0)
%% FILENAME : newsl.m
if nargin == 0 % does User provide Model Name ?
help(mfilename)
return
end
if ischar(mdlName) == 0 % Is Model Name a valid String ?
error(' NEWSL: You must define a Model Name, like ''MyNewModel'' !')
end
if exist(mdlName) == 4 % 4 = MDL-Name in ML Path
error(' NEWSL: Entered Modelname already exist!')
end
% Create a new Model
new_system(mdlName)
% ======== Some User specific Informations ==============
% .. reset his Position and size ...
set_param(mdlName', 'Location', [638 213 1350 524])
% -----------------------------------
author = 'Frank Gonzalez-Morphy';
desc_1st_line_0x = version; % standard versioning output of MATLAB
desc_1st_line_01 = 'Created under: ';
desc_1st_line = [desc_1st_line_01, desc_1st_line_0x];
% -----------------------------------
ml = ver('matlab'); % actual MATLAB Version
ml_ver_info = ['ML-Version: ', ml.Version, ' / Release Name: ', ml.Release ];
desc_2nd_line = ml_ver_info;
% -----------------------------------
sl = ver('simulink'); % actual Simulink Version
sl_ver_info = ['SL-Version: ', sl.Version, ' / Release Name: ', sl.Release ];
desc_3rd_line = sl_ver_info;
% -----------------------------------
desc_4th_line_0x = datestr(now); % Actual Time
desc_4th_line_01 = '$ Date: ';
desc_4th_line = [desc_4th_line_01, desc_4th_line_0x, ' $' ];
% -----------------------------------
set_param(mdlName, 'Creator', author)
desc = {desc_1st_line; ,...
desc_2nd_line; ,...
desc_3rd_line; ,...
desc_4th_line};
set_param(mdlName, 'Description', char(desc))
% =========================================================
sl = ver('simulink');
slver = str2num(sl.Version);
if slver(1,1) == 6
cs = get(getActiveConfigSet(mdlName));
set(cs.Components(7), 'RTWVerbose', 'off') % (7) = Simulink.RTWCC
end
% =========================================================
open_system(mdlName)
save_system(mdlName)
% Opens the SL-Library Browser
simulink
% Created with NEWFCN.m by Frank Gonzlez-Morphy
% Contact...: frank.gonzalez-morphy@mathworks.de
% ===== EOF ====== [newsl.m] ======