Declare chart data using the Model Explorer or the Symbol Wizard, which infers the scope of undeclared data.
Assign local and output data an initial value. When using C as the action language, data without an initial value is assumed to have an initial value of zero. Data read without an initial value causes an error when using MATLAB® as the action language.
Call MATLAB functions directly from states and transitions, or from a MATLAB Function block. Include user-defined MATLAB functions in the working folder and add that folder to the path. If you use a MATLAB Function block, user-defined functions are included with the model.
To generate code from your model, use features of the MATLAB language that are supported for code generation. Otherwise, use coder.extrinsic to call unsupported functions, which lets you achieve the desired functionality for simulation, but not in the generated code. For a list of supported features and functions, see MATLAB Language Features Supported for C/C++ Code Generation and Functions Supported for C/C++ Code Generation — Alphabetical List.