%% File Packaging for Atomic Subsystems (Code Only)
% This model shows how to partition an atomic subsystem into its own source file. Once a
% subsystem is specified as atomic, on the Subsystem Block Parameter dialog, on the *Code Generation* tab, 
% you can specify how the subsystem is represented in the generated code using the *Function packaging*
% parameter:

% Copyright 2019 The MathWorks, Inc.

%%
% 
% * |Inline|: an Inlined function
% * |Function|: function with I/O passed as global data
% * |Reusable function|: function with I/O passed as function arguments
% * |Auto|: Simulink Coder optimizes based on context

%%
% With the |Function| and |Reusable function| options,  you can specify a function and file name with  
% *Function name* and *File name*, respectively.  In the model, |rtwdemo_filepart|,
% |SS1| subsystem is configured as |Reusable function| with function name 
% |myfun| and file name |myfile|.

open_system('rtwdemo_filepart')

%%
% This capability only partitions the code for a subsystem. The data is declared and owned by 
% the parent model. For full system encapsulation (i.e., data and functions), use Model Reference.

%%
bdclose('rtwdemo_filepart');
