Why does MATLAB save() call saveobj() twice?

Viewed 641

I define a MATLAB object class_save_test:

classdef class_save_test 
    methods
        function b=saveobj(a)
            fprintf('saveobj called.\n');
            b=a;
        end
    end
end

When I try to save it:

j=class_save_test
save('delme1.mat','j')

I get the output

saveobj called.
saveobj called.

Why is it called twice? I have found this and this where people had the same question, but no answer :-(. I'm using Matlab 7.11.0 (R2010b).

Update: I have filed a support request with Mathworks... find their answer below :-).

1 Answers
Related