Main Content

polyspaceroot

Get Polyspace installation folder

Description

polyspaceroot returns the Polyspace® installation folder.

Starting in R2019a, to run MATLAB® scripts for Polyspace analysis, you install MATLAB and Polyspace in separate folders and link between them. After installation and linking, to access files in the Polyspace installation folder from MATLAB, use this function. See also Integrate Polyspace with MATLAB and Simulink or Integrate Polyspace Server Products with MATLAB.

example

Examples

collapse all

To determine the Polyspace installation folder, use the polyspaceroot function.

polyspaceroot
C:\Program Files\Polyspace\R2019a

With the products, Polyspace Bug Finder™ Server™ or Polyspace Code Prover™ Server, the default installation folder in Windows® is:

C:\Program Files\Polyspace Server\R2019a

To access sample files in the Polyspace installation folder, use the polyspaceroot function to get the root of the installation folder. Append subfolders to the root folder path with the fullfile function.

Run Bug Finder on the file numerical.c in the subfolder polyspace\examples\cxx\Bug_Finder_Example\sources of the Polyspace installation folder.

proj = polyspace.Project

% Specify sources and includes
sourceFile = fullfile(polyspaceroot, 'polyspace', ... 
    'examples', 'cxx', 'Bug_Finder_Example', 'sources', 'numerical.c');
includeFolder = fullfile(polyspaceroot, 'polyspace', ... 
    'examples', 'cxx', 'Bug_Finder_Example', 'sources');

% Configure analysis
proj.Configuration.Sources = {sourceFile};
proj.Configuration.TargetCompiler.Compiler = 'gnu4.9';
proj.Configuration.EnvironmentSettings.IncludeFolders = {includeFolder};
proj.Configuration.ResultsDir = fullfile(pwd,'results');

% Run analysis
bfStatus = proj.run('bugFinder');

Version History

Introduced in R2019a