Main Content


Manage MATLAB versions for cross-release code integration


[registeredVersions, installationFolders] = sharedCodeMATLABVersions returns the available MATLAB® versions and the installation folders.


sharedCodeMATLABVersions('Folder',versionInstallationFolder) registers a MATLAB version. The function specifies the folder where the MATLAB version is installed. The function checks that the folder corresponds to the matlabroot value for a valid installation, retrieves the MATLAB version number, and stores this information as a preference.

sharedCodeMATLABVersions('Remove', deregisterVersion) deregisters the MATLAB version and removes installation folder and version data.


collapse all

This code shows how you can register a previous release for your cross-release code integration workflow.

[registeredMATLABs, installationFolders] = sharedCodeMATLABVersions;
requiredVersion = 'R2017a';
typicalPath = 'C:\Program Files\MATLAB';

if isempty(registeredMATLABs) || ~any(strcmp(requiredVersion, registeredMATLABs))
  versionFolder = fullfile(typicalPath, requiredVersion);
  sharedCodeMATLABVersions('Folder', versionFolder);

Input Arguments

collapse all

Full path to the installation folder for the MATLAB version that you want to register.

Example: 'C:\Program Files\MATLAB\R2017a'

MATLAB version that you want to deregister.

Example: 'R2017a'

Output Arguments

collapse all

MATLAB release versions that are registered by the function.

Installation folder locations for registered MATLAB versions.

Version History

Introduced in R2017b