How to remove the data from a handle class from memory
이전 댓글 표시
I feel like an idiot but I don't seem to be able to solve the following problem:
When I define a handle class, how do I destroy it?
Example:
classdef test_class < handle
properties
% Lots of data
data = rand(1e4,1e4);
end
methods
function delete(obj)
% What do I put here to destroy the object itself: erase the object itself from memory
% Only "clear all" seems to work
end
end
end
Testing this with
x = test_class;
clear x
memory
clear all
memory
shows that the class data is effectively destroyed by clear all.
Does anyone know what code to use in the delete function ??
Thanks for you replies
Olaf
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Handle Classes에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!