MATLAB: Can I not deploy older Neural Networks with MATLAB Compiler 4.5 (R2006b)

compilerMATLAB Compilernetworksneuralnnet

I defined and trained a network using a previous version of the Neural Network Toolbox. I can load this network from a MAT-file using LOAD and simulate it using the SIM command with Neural Network Toolbox 5.0.1 (R2006b). However, when I deploy my application using the MATLAB Compiler 4.5 (R2006b), I receive the following errors at run-time:
ERROR: ??? Error using ==> network.subsasgn
"layers{1}.initFcn" cannot be set to non-existing function "initwb".
Error in ==> updatenet at 40
Error in ==> network.loadobj at 10
??? Undefined function or method 'sim' for input arguments of type 'struct'.
Error in ==> mynetworkapp at 30

Best Answer

This bug has been fixed in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
This is the expected behavior. Loading networks saved from older Neural Network Toolbox versions requires some initialization routines that are not deployable. Therefore these networks cannot be deployed without first being updated - i.e, loaded and saved in your current version of MATLAB.
To work around this issue, update your network in a standard MATLAB session, and deploy the updated network.
To do this, LOAD and SAVE your network in the same release of MATLAB as your compiled application. This can be done as follows:
load oldnet.mat myNetwork
save newnet.mat myNetwork
This will produce an updated version of your network that can be deployed in an application that uses the LOAD and SIM commands.
You can find more information about toolbox compatibility at the link below: