matlab.metadata.Namespace - Describe MATLAB namespace - MATLAB (original) (raw)
As of R2024a, the namespace, class name, methods, and some properties ofmeta.package
have been renamed. Their behavior remains the same.
- The new namespace is
matlab.metadata
. - The new class name is
Namespace
. - The two static methods of this class use the new namespace and class name. Also,
meta.package.getAllPackages
is nowmatlab.metadata.Namespace.getAllNamespaces
. - Some of the properties of this class have new names.
Name in R2023b and Earlier New Name as of R2024a ContainingPackage OuterNamespace Packages InnerNamespaces
MATLAB will continue to recognize the old metaclass names in most contexts. However, code that relies on string comparisons to identify metaclasses might need to be updated to continue to work as expected. For example, if mObj
in the example below is a matlab.metadata.Namespace
instance, the code under thecase
statement for 'meta.package'
does not execute because class(mObj)
returns'matlab.metadata.Namespace'
.
switch class(mObj) case 'meta.package' % code to execute if mObj is a meta.package instance ... end
To ensure this code continues to work as intended, use an if
statement with isa
. The isa
command recognizes both the old and new names of the class.
if isa(mObj,'meta.package') % code to execute if mObj is a matlab.metadata.Namespace instance else ... end
If compatibility with older releases of MATLAB is not a concern, you can update 'meta.package'
to'matlab.metadata.Namespace'
. However, continue to use the old name if your code needs to run on versions of MATLAB before R2024a.