matlab.alias.AliasFileManager Class
R2026bNamespace: matlab.alias
Create and manage class alias definitions
Description
The matlab.alias.AliasFileManager class enables you to create and manage
class alias definitions. The alias definitions map one or more old class names to a new name.
Use this functionality to change the name of an existing class while maintaining compatibility
with code and MAT files that use the older names of the class. The recommended process for
creating aliases is to write a function that creates an instance of
AliasFileManager.
For more information, see Creating and Managing Class Aliases.
The matlab.alias.AliasFileManager class is a handle class.
Creation
Description
creates an fileMgr = matlab.alias.AliasFileManagerAliasFileManager instance with no alias definitions.
creates an fileMgr = matlab.alias.AliasFileManager(location)AliasFileManager instance and loads the alias
file in the specified location. The location argument is the path to
the parent folder of the resources folder containing an alias
definition file. This syntax provides a convenient way to view all of the defined class
aliases at location.
Input Arguments
Properties
Methods
Examples
Tips
After aliasing a class to a new name, clear existing instances of the class from the workspace to avoid errors.
The function workflow demonstrated in the examples has the advantage of automatically clearing the instance of
AliasFileManager.Deprecating old class aliases is not recommended. Removing the old aliases risks compatibility issues for the users of your code. To access an existing alias definition file, use the
fileMgr=matlab.alias.AliasFileManager(location) constructor and read itsAliasesproperty.When a function and a class alias have the same name, introspection identifies the alias even if the function would otherwise have precedence. For example, if there is a function named
MyOldClass.mand a class that has"MyOldClass"as an alias, the statementmc = matlab.metadata.Class.fromName('MyOldClass');returns a metaclass instance of the class that defines the alias, even if the function has precedence because of path order.


