Resetting a memoized function

I know that clearCache will clear the cache of a MemoizedFunction, but how would you reset its other properties to their defaults? I would have thought that rebuilding it with memoize() would do so, but the test below shows that that does not work.
mf=memoize(@localFcn) %default property values

mf.CacheSize=3; mf.Enabled=false %make some non-default property settings

clear mf
mf=memoize(@localFcn) %clear and rebuild — but property values do not reset!!!!

function y=localFcn(x)
y=x.^2;
endI know that clearCache will clear the cache of a MemoizedFunction, but how would you reset its other properties to their defaults? I would have thought that rebuilding it with memoize() would do so, but the test below shows that that does not work.
mf=memoize(@localFcn) %default property values

mf.CacheSize=3; mf.Enabled=false %make some non-default property settings

clear mf
mf=memoize(@localFcn) %clear and rebuild — but property values do not reset!!!!

function y=localFcn(x)
y=x.^2;
end I know that clearCache will clear the cache of a MemoizedFunction, but how would you reset its other properties to their defaults? I would have thought that rebuilding it with memoize() would do so, but the test below shows that that does not work.
mf=memoize(@localFcn) %default property values

mf.CacheSize=3; mf.Enabled=false %make some non-default property settings

clear mf
mf=memoize(@localFcn) %clear and rebuild — but property values do not reset!!!!

function y=localFcn(x)
y=x.^2;
end memoize MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *