Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MatLab OOP不改变属性_Matlab_Oop - Fatal编程技术网

MatLab OOP不改变属性

MatLab OOP不改变属性,matlab,oop,Matlab,Oop,我有一个属性为“next state”的matlab类 我在类中定义了以下函数: function obj = decideNextAction(obj) obj.current_patch_quality % Important, rand is redeclared in the two calls. So it may be % that rand < current_patch_quality in the f

我有一个属性为“next state”的matlab类

我在类中定义了以下函数:

function obj = decideNextAction(obj)
            obj.current_patch_quality
            % Important, rand is redeclared in the two calls. So it may be
            % that rand < current_patch_quality in the first if and greater
            % than in the second if
            if(rand > obj.current_patch_quality)
                obj.next_action = 1;
            elseif(rand < obj.current_patch_quality)
                obj.next_action = 3;
            else
                obj.next_action = 2;
            end   


        end

您必须在
classdef
中使用
handleclass

classdef myclass < handle
classdef myclass < handle
x = x.decideNextAction();