matlab.System.getGlobalNamesImpl - Global variable names for MATLAB System block - MATLAB (original) (raw)
Main Content
Class: matlab.System
Global variable names for MATLAB System block
Syntax
name = getGlobalNamesImpl(obj)
Description
[name](#bvf8avq-1-name) = getGlobalNamesImpl([obj](#bvf8avq-1%5Fsep%5Fmw%5F353aa417-3412-46f8-81f1-586adf7da5a8))
specifies the names of global variables that are declared in a System object™ for use in a Simulink® P-code file. For P-code files, in addition to declaring your global variables instepImpl
, outputImpl
, orupdateImpl
, you must include the getGlobalNamesImpl
method. You declare global variables in a cell array in thegetGlobalNamesImpl
method. System objects that contain these global variables are included in Simulink using a MATLAB System (Simulink) block. To enable a global variable in Simulink, your model also must include a Data Store Memory (Simulink) block with a Data Store Name that matches the global variable name.
Run-Time Details
getGlobalNamesImpl
is called by the MATLAB System block.
Method Authoring Tips
You must set Access = protected
for this method.
Input Arguments
System object handle used to access properties, states, and methods specific to the object. If your getGlobalNamesImpl
method does not use the object, you can replace this input with ~
.
Output Arguments
Cell array containing the global variable names. The elements of the cell array are character vectors.
Examples
Specify two global names in your class definition file.
methods(Access = protected) function glnames = getGlobalNamesImpl(obj) glnames = {'FEE','OTHERFEE'}; end
function y = stepImpl(obj,u)
global FEE
global OTHERFEE
y = u - FEE * obj.lastData + OTHERFEE;
obj.lastData = u;
end
end
Version History
Introduced in R2016b