setupImpl(obj) sets up a System object™ and
implements one-time tasks that do not depend on any inputs to its
You typically use
setupImpl to set private properties
so they do not need to be calculated each time
is called. To acquire resources for a System object, you must
setupImpl instead of a constructor.
setupImpl executes the first time the
is called on an object after that object has been created. It also
executes the next time
step is called after an object
has been released.
setupImpl(obj,input1,input2,...) sets up
a System object using one or more of the
specifications. The number and order of inputs must match the number
and order of inputs defined in the
You pass the inputs into
setupImpl to use the specifications,
such as size and data types in the one-time calculations.
setupImpl is called by the
which is done automatically as the first subtask of the
on an unlocked System object.
Note: You can omit this method from your class definition file if your System object does not require any setup tasks.
You must set
Do not use
You cannot modify any tunable properties in this method if its System object will be used in the Simulink® MATLAB System block.
To validate properties or inputs use the
setProperties methods. Do not include validation
Do not use the
setupImpl method to set up input
System object handle
Inputs to the
This example shows how to open a file for writing
setupImpl method in your class definition
methods (Access = protected) function setupImpl(obj) obj.pFileID = fopen(obj.Filename,'wb'); if obj.pFileID < 0 error('Opening the file failed'); end end end