MATLAB: When deploying a Web App, why does MATLAB code fail to instantiate an object

MATLAB Compiler

I have developed an app and deployed it onto a web app server. The MATLAB code fails at recognizing an object called "strat".
Then, I get the following warning message and an error afterwards:
Warning: Variable 'a' originally saved as a strat cannot be instantiated as an object
and will be read in as a uint32

Best Answer

When using classes in a deployed component, the class definition will also have to be complied into the deployed component. Usually the dependency analysis will do this, but it does not look at the dependency inside the MAT-files that the code is trying to load. Therefore, the issue you are facing is probably due to trying to load a saved object from a MAT-file.
To resolve this issue make sure the class definition is compiled into the deployed component. There are a few ways to do this:
1) Use the '%#function' pragma. Please follow the link below to view the documentation for more details:
2) By manually adding the class to the "files required by your application to run" in the compiler app.
3) Use the 'mcc' command to the input argument option set as '-a'. Please follow the link below to view the documentation for more details: