How to set Polyspace configuration options for a model programmatically?

7 views (last 30 days)
I would like to know how to use the parameter PSAddSuffixToResultDir in the Polyspace configuration.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 6 Dec 2022
Edited: MathWorks Support Team on 6 Dec 2022
You can set Polysapce configuration options after getting the Simulink ConfigSet as below.
bdclose all;
openExample('polyspace_code_prover/OpenModelForCodeGenerationAndPolyspaceAnalysisExample')
pssharedprivate('attachConfigComp', gcs) % Active the Polyspace Configuration.
cfg_set = getActiveConfigSet(gcs);
get_param (cfg_set, 'PSAddSuffixToResultDir')
set_param (cfg_set, 'PSAddSuffixToResultDir', 1)  % Active the option 'Make output folder name unique by adding a suffix'. This option is to add a unique suffix to the results folder for every run to avoid overwriting previous results.
You can do better and set Polyspace configuration options with 'pslinkoptions'.
For example,
bdclose all;
openExample('polyspace_code_prover/OpenModelForCodeGenerationAndPolyspaceAnalysisExample')
mlopts = pslinkoptions('polyspace_controller_demo');
mlopts.AddSuffixToResultDir = 1;  % Active the option 'Make output folder name unique by adding a suffix'. This option is to add a unique suffix to the results folder for every run to avoid overwriting previous results.
Note: The above example model is used in the following example documentation.

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by