Create a Function for Checking Multiple Systems in Parallel

If you have a Parallel Computing Toolbox™ license and a multicore host machine, you can create the following function to check multiple systems in parallel:

  1. Create the run_configuration function.

  2. Save the function as run_fast_configuration.m.

  3. In the Editor, change the name of the function to run_fast_configuration.

  4. In the function, set 'ParallelMode' to 'On' . When you use with ‘ParallelMode' set to ‘On', MATLAB® automatically creates a parallel pool.

    SysResultObjArray =,'Configuration',fileName,...

    The function should now look like this:

    function [fail, warn] = run_fast_configuration(SysList)
    %RUN_FAST_CONFIGURATION Check systems in parallel with Model Advisor
    %   Return number of warnings and failures.
    fileName = 'slvnvdemo_mdladv_config.mat';
    SysResultObjArray =,'Configuration',fileName,...
    for i=1:length(SysResultObjArray)
        fail = fail + SysResultObjArray{i}.numFail;
        warn = warn + SysResultObjArray{i}.numWarn;

  5. Save the function.

  6. Test the function. In the MATLAB Command Window, create a list of systems:

    SysList={'sldemo_auto_climatecontrol/Heater Control',...
        'sldemo_auto_climatecontrol/AC Control','rtwdemo_iec61508'};

  7. Run run_fast_configuration on the list of systems:

    [failures, warnings] = run_fast_configuration(SysList);

  8. Review the results. Click the Summary Report link to open the Model Advisor Command-Line Summary report.

See Also

Related Examples

Was this topic helpful?