MATLAB: How to gain performance when working with MATLAB class objects using the Parallel Computing Toolbox 4.2(R2009b)

dctdistributedMATLABmcosobjectoopsorientedparallelpct

I would like to see an example of using Parallel Computing Toolbox with MATLAB classes and objects. Specifically, I would like to see how to ensure that Parallel Computing Toolbox can speed up using class methods.

Best Answer

The attached zip file model a simple banking system. The files, "BankAccount.m" and "AccountManager.m" are the class files for bank account and account manager classes.
The BankAccount class takes care of creating a BankAccount and making deposits or withdrawals. The AccountManager class ensures that there are sufficient funds in the account, and has information on whether an account is open or closed.
Apart from the class files, for parallel processing purposes, 2 additional files are also present: "makeDeposit.m" and "testMObj.m".
"makeDeposit.m" is meant to deposit a specified amount into a bank account. "testMObj.m" is meant for parallelizing this deposit procedure using createParallelJob and createTask methods.
You can run "testMObj.m" to see the job creation and the parallel processed output.