Classdef: Difference between revisions

Jump to navigation Jump to search
Line 1: Line 1:
This page is a stub. We should begin documenting what classdef is implemented and what is not.
This page is a stub. We should begin documenting what classdef is implemented and what is not.


==== not supported ====
=== Not Supported ===


* debugging in classdef methods (and +package directory functions)
* '''debugging in classdef methods (and +package directory functions)'''


Breakpoints cannot currently be set in classdef methods (or at least they are ignored). They also can't be set in functions in +package directories (which is a related issue).
Breakpoints cannot currently be set in classdef methods (or at least they are ignored). They also can't be set in functions in +package directories (which is a related issue).


* enumeration
 
* '''enumeration'''
 


* build-in class as superclass  
* build-in class as superclass  
Line 16: Line 18:
</source>
</source>


* [http://www.mathworks.com/help/matlab/matlab_oop/redefining-concatenation-for-your-class.html concatenating objects] into [http://www.mathworks.com/help/matlab/matlab_oop/initialize-object-arrays.html array of objects]. Example:
 
* '''[http://www.mathworks.com/help/matlab/matlab_oop/redefining-concatenation-for-your-class.html concatenating objects] into [http://www.mathworks.com/help/matlab/matlab_oop/initialize-object-arrays.html array of objects].'''
 
Example:
<source lang="octave">
<source lang="octave">
classdef MyClass < handle
classdef MyClass < handle
Line 30: Line 35:
</source>
</source>


* [http://www.mathworks.com/help/matlab/matlab_oop/mutable-and-immutable-properties.html Immutable property] set access. Example:
 
* '''[http://www.mathworks.com/help/matlab/matlab_oop/mutable-and-immutable-properties.html Immutable property] set access. Example:'''
<source lang="octave">
<source lang="octave">
classdef MyClass < handle
classdef MyClass < handle
Line 46: Line 52:
Use "private" properties as workaround.
Use "private" properties as workaround.


* Function handles to package methods and static class methods.
 
* '''Function handles to package methods and static class methods.'''
For example if we have <code>+mypackage/myfunc.m</code>, creating a function handle as <code>fh = @mypackage.myfunc</code> won't work.
For example if we have <code>+mypackage/myfunc.m</code>, creating a function handle as <code>fh = @mypackage.myfunc</code> won't work.
As a workaround, we can create an indirection using an anonymous function <code>fh = @(varargin) mypackage.myfunc(varargin{:})</code>.
As a workaround, we can create an indirection using an anonymous function <code>fh = @(varargin) mypackage.myfunc(varargin{:})</code>.
Line 95: Line 102:




* Defining [http://www.mathworks.com/help/matlab/matlab_oop/specifying-methods-and-functions.html#br2la89 local functions] in the same classdef-file is not working. For example, the following code gives a syntax/parse error:
* '''Defining [http://www.mathworks.com/help/matlab/matlab_oop/specifying-methods-and-functions.html#br2la89 local functions] in the same classdef-file is not working.'''
For example, the following code gives a syntax/parse error:
<source lang="octave">
<source lang="octave">
classdef MyClass
classdef MyClass
39

edits

Navigation menu