Products & Services Solutions Academia Support User Community Company

Learn more about Simulink Design Optimization   

finddepend - List of model path dependencies

Syntax

dirs=finddepend(proj)

Description

dirs=finddepend(proj) returns paths containing Simulink model dependencies required for parameter optimization using parallel computing. proj is a response optimization project for the model created using newsro or getsro. dirs is a cell array, where each element is a path string. dirs is empty when finddepend does not detect any model dependencies. Append paths to dirs when the list of paths is empty or incomplete.

finddepend does not return a complete list of model dependency paths when the dependencies are undetectable.

Examples

List model path dependencies required for parallel computing:

% Copy Simulink boiler library to temporary folder.
pathToLib = boilerpressure_setup;   
% Add folder to search path.
addpath(pathToLib);
% Open Simulink model.
boilerpressure_demo
% Extract response optimization project.
proj=getsro('boilerpressure_demo');
% Enable parallel computing.
optimset(proj,'UseParallel','always');
% Get model dependency paths.
dirs=finddepend(proj)
% Add paths to optimization project.
optimset(proj,'ParallelPathDependencies',dirs) 
 

Make local paths accessible to remote workers:

% Copy Simulink boiler library to temporary folder.
pathToLib = boilerpressure_setup;   
% Add folder to search path.
addpath(pathToLib);
% Open Simulink model.
boilerpressure_demo
% Extract response optimization project.
proj=getsro('boilerpressure_demo');
% Enable parallel computing.
optimset(proj,'UseParallel','always');
% Get model dependency paths.
dirs=finddepend(proj)
% The resulting path is on a local drive, C:/.
% Replace C:/ with valid network path accessible to remote workers.
dirs = regexprep(dirs,'C:/','\\\\hostname\\C$\\')
% Add paths to optimization project.
optimset(proj,'ParallelPathDependencies',dirs) 
 

Append path to model path dependency list:

% Copy Simulink boiler library to temporary folder.
pathToLib = boilerpressure_setup;   
% Add folder to search path.
addpath(pathToLib);
% Open Simulink model.
boilerpressure_demo
% Extract response optimization project.
proj=getsro('boilerpressure_demo');
% Enable parallel computing.
optimset(proj,'UseParallel','always');
% Get model dependency paths.
dirs=finddepend(proj)
% Append an additional path.
dirs=vertcat(dirs,'\\hostname\C$\matlab\work')
% Add paths to optimization project.
optimset(proj,'ParallelPathDependencies',dirs) 

Alternatives

Identify model path dependencies using the GUI:

  1. In the Simulink model, double-click the Signal Constraint block to open the Block Parameters: Signal Constraint window.

  2. In the Block Parameters window, select Optimization > Parallel Options to open the Parallel Options tab.

  3. Select the Use the matlabpool during optimization option to identify the model dependencies automatically.

See Also

getsro | newsro | optimget | optimset

Tutorials

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS