MATLAB Object-Oriented Programming

(Joyce) #1

Use of Editor and Debugger with Classes


In this section...
“Write Class Code in the Editor” on page 5-49
“How to Refer to Class Files” on page 5-49
“How to Debug Class Files” on page 5-50

Write Class Code in the Editor


The MATLAB code editor provides an effective environment for class development. The
Code Analyzer, which is built into the editor, check code for problems and provides
information on fixing these problems. For information on editor use and features, see
edit.

How to Refer to Class Files


Define classes in files just like scripts and functions. To use the editor or debugger with a
class file, use the full class name. For example, suppose the file for a class, myclass.m is
in the following location:

+PackFld1/+PackFld2/@myclass/myclass.m

To open myclass.m in the MATLAB editor, you could reference the file using dot-
separated package names:

edit PackFld1.PackFld2.myclass

You could also use path notation:

edit +PackFld1/+PackFld2/@myclass/myclass

If myclass.m is not in a class folder, then enter:

edit +PackFld1/+PackFld2/myclass

To refer to functions inside a package folder, use dot or path separators:

edit PackFld1.PackFld2.packFunction
edit +PackFld1/+PackFld2/packFunction

To refer to a function defined in its own file inside of a class folder, use:

Use of Editor and Debugger with Classes
Free download pdf