%% Arrays for Signals

% Copyright 2020 The MathWorks, Inc.

%% C Construct
% <include>c_construct_arrays_for_signals.txt</include>
%% Procedure
% 1. Open example model <matlab:ex_signal_array |ex_signal_array|>.
open_system('ex_signal_array');

%%
% 2. In the Model Data Editor, select the *Inports/Outports* tab.
%
% 3. From the *Change View* drop-down list, select |Design|.
%
% Observe these settings:
%
% * For the Inport block, the *Signal Name* is |myIn| and Dimensions is 
%   |[5 1]|.
% * For the Outport block, the *Signal Name* is |myOut|.
%
% 4. Open the *Embedded Coder* app.
%
% 5. In the *C Code* tab, select *Code Interface* > *Individual Element
%    Code Mappings*.
%
% 6. In the Code Mappings editor, on the *Inports* tab, for the Inport block 
%    and the Outport block, the *Storage Class* is |ExportedGlobal|. 
%    With this setting, the blocks appear in the generated 
%    code as separate global variables.
%
% 7. To build the model and generate code, press *Ctrl+B* .
evalc('rtwbuild(''ex_signal_array'')');

%% Results
% The generated source file |ex_signal_array.c| defines the global variables 
% |myIn| and |myOut| as arrays with 5 elements each.
file = fullfile('ex_signal_array_ert_rtw','ex_signal_array.c');
rtwdemodbtype(file,'/* Exported block signals */', ...
    '/* Model step function */',1,1);










