Creating an Empty Model

www.kxcad.net Home > CAE Software Index > MATLAB Index >



To create an empty model, click the New button on the Library Browser's toolbar (Windows only) or choose New from the library window's File menu and select Model. Simulink creates an empty model in memory and displays it in a new model editor window.

Creating a Model Template

When creating a model, Simulink uses defaults for many of its configuration parameters. For instance, by default, new models have a white canvas, the ode45 solver, and a visible toolbar. If these defaults are not to your liking, use Simulink model construction commands (see Model Construction) to write a function that creates a model with the defaults you prefer.

For example, the following function creates a Simulink model that has a green canvas and a hidden toolbar and uses the ode3 solver:

function new_model(modelname) 
% NEW_MODEL Create a new, empty Simulink model
%    NEW_MODEL('MODELNAME') creates a new model with
%    the name 'MODELNAME'. Without the 'MODELNAME'
%    argument, the new model is named 'my_untitled'.

if nargin == 0 
     modelname = 'my_untitled';
end 

% create and open the model
open_system(new_system(modelname));

% set default screen color
set_param(modelname, 'ScreenColor', 'green');

% set default solver
set_param(modelname, 'Solver', 'ode3');

% set default toolbar visibility
set_param(modelname, 'Toolbar', 'off');

% save the model
save_system(modelname);
  


© 1984-2007 The MathWorks, Inc. Terms of Use Patents Trademarks Acknowledgments