Hi, let's say I have two classes A_Class() and B_Class(). The A_Class() is defined something like this:
classdef A_Class < handle
properties
B;
end
methods
function obj = A_Class()
obj.B{1} = B_Class();
obj.B{2} = B_Class();
obj.B{3} = B_Class();
end
end
end
I create an object of class A_Class(),
Then I run the following command:
and the answer is 3, which is correct. However, when I delete the object A.B{3} using the command delete(A.B{3}) the object gets deleted but when I check for length of B using command length(A.B) the answer is still 3, why? When I try to access A.B{3} matlab tells me that it is an invalid or deleted object, but still gives an answer 3 for the length of A.B why? How can make the answer 2, which is the correct answer. This is frustrating, I tried clearing the handle A.B{3} but that does not help. Any help will be appriciated, thanks a lot in advance :)
0 Comments
Sign in to comment.