%% Map Data Store Memory for an Atomic Subchart
% This model consists of two Sine Wave blocks that supply input signals to
% a chart.

% Copyright 2018-2019 The MathWorks, Inc.

mdl = 'sf_atomic_subcharts_map_dsm_fixed';
open_system(mdl)

%%
% The chart contains a linked atomic subchart from a library.

open_system('sf_atomic_subcharts_map_dsm_fixed/Chart')

%%
% The linked atomic subchart contains these objects.

open_system('sf_atomic_subcharts_map_dsm_fixed/Chart/A')

%%
% If you simulate the model, you get an error because the data store
% memory |dsm| does not map to any variable in the main chart. To edit the
% mapping for |dsm|:
%
% # Right-click subchart A and select *Subchart Mappings*.
% # Under *Data Store Memory Mapping*, specify the main chart symbol for
% |dsm| to be |local_for_atomic_subchart|.
% # Click *OK*.
%
% When you run the model again, you get these results.

sim(mdl);
open_system('sf_atomic_subcharts_map_dsm_fixed/Scope')