There are two ways create folders that contain class-definition files:
Path folder — a folder that is on the MATLAB® path.
Class folder — a folder
that is in a path folder and is name with the
and the class name. For example:
Class folders are not directly on the MATLAB path. The path folder that contains the class folder is on the MATLAB path.
There are two ways to specify classes with respect to files and folders:
Create a single, self-contained class definition file in a path folder or a class folder
Define a class in multiple files, which requires you to use a class folder inside a path folder
Create a single, self-contained class definition file in a folder
on the MATLAB® path. The name of the file must match the class
(and constructor) name and must have the
Define the class entirely in this file. You can put other single-file
classes in this folder.
The following diagram shows an example of this folder organization.
a folder on the MATLAB path.
If you use multiple files to define a class, put all the class-definition
files (the file containing the
classdef and all
class method files) in a single @
That class folder must be inside a folder that is on the MATLAB path.
You can define only one class in a class folder.
A path folder can contain classes defined in both class folders and single files without a class folder.
The parent folder to a package folder is on the MATLAB path,
but the package folder is not. Package folders (which always begin
+ character) can contain multiple class
definitions, package-scoped functions, and other packages. A package
folder defines a new name space in which you can reuse class names.
Use the package name to refer to classes and functions defined in
package folders (for example,