MATLAB: Does the documentation not have complete information on the limit of number of referenced models that can be used in a model with Simulink 6.4 (R2006a) on Windows

simulink

I have a model which contains some model referencing blocks and I am able to successfully simulate the model. However, when I add an extra model referencing block, I receive the following error when using LCC with GMAKE:
The input line is too long.
:getarg was unexpected at this time.
gmake: *** [..\..\../mr_lat_aero_msf.mexw32] Error 0xff
Or the following error when using MSVC with NMAKE:
NMAKE : fatal error U1095: expanded command line '<include path here>' too long
Stop.
The make command returned an error of 2
'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command,
operable program or batch file.
### Real-Time Workshop build procedure for model: 'modelname' aborted due to an error.

Best Answer

This enhancement has been incorporated in Release 2008a (R2008a). For previous product releases, read below for any possible workarounds:
Documentation regarding the limitations on the number of referenced models is not complete. Additional information can be found in "ModelRef_Scalabilit_windows.doc" attached below.
Also, the attached function COUNT_MDLREFS can be used to count the number of instances of each model under a top model. This function will return a list of all models referenced by this model, along with a vector containing the count of the number of instances that model shows up in the hierarchy.
For example, after you execute this command:
[refmdls,tally] = count_mdlrefs('sldemo_mdlref_depgraph')
The following lines of code could be used to change the 'Total number of instances allowed per top model' property of the referenced models to 'Single' if it is set to multiple.
for i=1:length(refmdls)
load_system(refmdls{i});
if strcmp(get_param(refmdls{i},'ModelReferenceNumInstancesAllowed'),'Multi')
set_param(refmdls{i},'ModelReferenceNumInstancesAllowed','Single');
end
end
NOTE:sldemo_mdlref_depgraph is a demo model shipped with R2007a.