MATLAB: Call a function in an m-file from a method of a handle class

classhandlesMATLAB

I would like to know, if the object, which is being created with the help of the (handle) class methods, would also be visible for modifications in a function called from a method of the (handle) class, even if I don't pass the object itself to that function?
If the object is visible to the function called in a class method, so I can just work with it from the function using it's name from the class itself (using the name of the "constructor function")?
Or must I pass the object to the function called in the class method?…
Thank you for your answer in advance!

Best Answer

A method operating on objects of a class must have the object as its first input in matlab. (In other languages, e.g C++, this first parameter is automatically added by the compiler).
However, you can separate the methods of a class into different files. See this page for the details. Basically, create a folder named @yourclassname, populate this folder with at least yourclassname.m which can just contain the class definition. You can implement the methods either in yourclassname.m or in separate files in the same @ folder. Either way, the first input of the method must be the class object.