Programming Previous page   Next Page

The saveobj Method

MATLAB looks for the portfolio saveobj method whenever the save command is passed a portfolio object. If @portfolio/saveobj exists, MATLAB passes the portfolio object to saveobj, which must then return the modified object as an output argument. The following implementation of saveobj determines if the object has already been assigned an account number from a previous save operation. If not, saveobj calls getAccountNumber to obtain the number and assigns it to the accountNumber field.


Previous page  Example -- Defining saveobj and loadobj for Portfolio The loadobj Method Next page

© 1994-2005 The MathWorks, Inc.