MATLAB: How to solve this issue?Help me out

classoop

classdef CEntity
properties
RandNumb
end
methods
function obj = CEntity
InitArray12()
end
end
end
function InitArray12()
obj.RandNumb=randi(100)
end
How to send value which is calculated in the "InitArray12" function to "RandNumb" which is there in the properties

Best Answer

Or this way
>> ce = CEntity()
ce =
CEntity
Properties:
RandNumb: 92
Methods
>>
where
classdef CEntity < handle
properties
RandNumb
end
methods
function obj = CEntity
InitArray12();
end
function InitArray12( obj )
obj.RandNumb = randi( 100 );
end
end
end
Read the entry "Value or Handle Class — Which to Use" in the on-line help