Dear lovely community,
I already looked in Google and in the forum and also found some interesting posts. But in the end I still didn't get it worked. So, I am going to post the question here. I know in Matlab are already get/ Set methods implemented, but I am using objects and therefore I didn't understand where to implement them.
In my Interface I declare my functions I want to implement and this Interface is furthermore abstract. It looks like this:
classdef MeasuererIF < handle methods (Abstract=true) getStatus(cObj) ; setStatus(cObj,iStatus) ; getInfo(cObj) ; setInfo(cObj,sInfo) ; end
Then I created the other class MeasurerComponent in which I implemented the methods and also the constructor:
classdef MeasurerComponent < PerformanceMeasurement.MeasuererIF %% MeasurerComponent: Evaluates which model is used and contains them as childs. % Detailed explanation goes here properties (Access=protected) miStatus; msInfo; mcData; end methods %constructor function cObj = PerformanceMeasurement.MeasurerComponent ; cObj.miStatus = -1 ; cObj.msInfo = 'Import' ; cObj.mcData =  ; end %Status function setStatus(cObj,iStatus) cObj.miStatus = iStatus; end function iStatus = getStatus(cObj) iStatus = cObj.miStatus; end %Info function setInfo(cObj,sInfo) cObj.msInfo = sInfo; end function sInfo = getInfo(cObj) sInfo = cObj.msInfo ; end end
Earlier I just used the
getMethods and recently added the
setMethods and now it doesn't work anymore. The Problem is that when I create an object
obj = Measurement.MeasurerComponent
the programm doesn't initialize the values anymore.
For a = obj.getInfo;
I receive just
Does someone has an idea why it doesn't get initialized anymore? After I received a tip I changed the initialization process to the constructor due to the handle class.
I am really thankful and glad about each hint and tip! Cheers