| Contents | Index |
b = saveobj(a)
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.
Call the superclass saveobj method from the subclass implementation of saveobj with the following syntax:
classdef mySub < super methods function sobj = saveobj(obj) % Call superclass saveobj method sobj = saveobj@super(obj); % Perform subclass save operations ... end ... end ... end
See Saving and Loading Objects from Class Hierarchies.
Update object when saved:
function b = saveobj(a) % If the object does not have an account number, % call method to add account number to AccountNumber property if isempty(a.AccountNumber) a.AccountNumber = getAccountNumber(a); end b = a; end
See Example — Maintaining Class Compatibility.

Explore how to use MATLAB to make advancements in engineering and science.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |