Skip to Main Content Skip to Search
Accelerating the pace of engineering and science

Why do I receive an error when I compile the SIM function in Neural Networks Toolbox 4.0.3 (R14) using MATLAB Compiler 4.0 (R14) and later?


Date Last Modified: Monday, June 20, 2011
Solution ID:   1-15YVJB
Product:   MATLAB Compiler
Reported in Release:   R14SP2
Fixed in Release:   R2011a
Platform:   All Platforms
Operating System:   All OS
 

Subject:

Why do I receive an error when I compile the SIM function in Neural Networks Toolbox 4.0.3 (R14) using MATLAB Compiler 4.0 (R14) and later?

Problem Description:

I have pre-trained my network using the Neural Networks Toolbox 4.0.3 (R14), and I am able to use the SIM function to simulate the network. I can then successfully create a standalone application using using MATLAB Compiler 4.0 (R14) with the following command:

mcc -m -v nnpredict2.m

However, when I try to run my standalone application I receive the following error:

Warning: Class ':all:' is an unknown object class. Object 'net' of this
class has been converted to a structure.
> In nnpredict2 at 15
Undefined command/function 'sim'.
Error in ==> nnpredict2 at 41

Solution:

This enhancement has been incorporated in Release 2011a (R2011a). For previous product releases, read below for any possible workarounds:

The ability to compile the SIM function in Neural Networks Toolbox 4.0.3 (R14) using MATLAB Compiler 4.0 (R14) and later exists as long as the network is pre-trained. However, this problem arises because the Neural Networks Toolbox uses an overloaded version of the SIM function that is shipped with Simulink, which cannot be compiled. To ensure that MATLAB Compiler recognizes the Neural Networks SIM function, add the following line of code to your main function that you are compiling.
%#function network
This function pragma will alert the MATLAB Compiler of which SIM command your algorithm requires.

Please provide feedback to help us improve this Solution
Contact support