The way you describe using classes is the "old" way to do this in Matlab. I donβt know how it all works when you use the "old" method, but class files make life easier. I highly recommend them. Thus, you can put all the functions for the class into a single file. For example, you can create a file:
myclass.m
classdef myclass methods function out=add(a,b) out=a+b end function out=subtract(a,b) out=ab end end end
If you put myclass.m in the same folder as your m file. Then you can access the class as follows:
a=5; b=3; asdf=myclass; c=asdf.add(a,b) d=asdf.subtract(a,b)
A more extensive example is given at the following link:
http://www.mathworks.com/help/techdoc/matlab_oop/brhzttf.html
I hope this helps.
source share