saveobj
Modify save process for object
Syntax
b = saveobj(a)
Description
b = saveobj(a)
is called by the save
function if the class of a
defines
a saveobj
method. save
writes
the returned value, b
, to the MAT-file.
Define a loadobj
method
to take the appropriate action when loading the object.
If A
is an array of objects, MATLAB® invokes saveobj
separately
for each object saved.
Examples
Call the superclass saveobj
method from the subclass implementation of
saveobj
with this syntax:
classdef mySub < super methods function sobj = saveobj(obj) % Call superclass saveobj method sobj = saveobj@super(obj); % Perform subclass save operations ... end ... end ... end
Update object when saved:
function b = saveobj(a) % If the object does not have an account number, % Add account number to AccountNumber property if isempty(a.AccountNumber) a.AccountNumber = getAccountNumber(a); end b = a; end
Version History
Introduced before R2006a