Get path name of current system
gcs returns the path name of the current system. The current
system is one of these:
During editing, the system or subsystem most recently clicked or that contains the block most recently clicked
During simulation of a system that contains an S-Function block, the system or subsystem containing the S-Function block currently being evaluated
When a callback is invoked, the system executing the callback
During evaluation of
MaskInitialization, the system containing the block whose mask is being evaluated
The system most recently loaded into memory with
load_system; only the first use of
load_systemmakes the model the current system
The current system is the current model or a subsystem of the current model. Use
bdroot to get the current model.
If you close the model that contains the current system, another open or loaded
system becomes the current one. Use
gcs to find out the new current
To explicitly set the current system, you can either:
'CurrentSystem'parameter on the root Simulink® model, for example:
Open the model by using
open_systemor the model name at the MATLAB® command prompt.
Get Current System That Contains a Block
Return the path of the system that contains the most recently selected block.
Open the Model a Fault-Tolerant Fuel Control System example model
sldemo_fuelsys. Open the subsystem To Controller.
openExample('simulink_automotive/ModelingAFaultTolerantFuelControlSystemExample') sldemo_fuelsys open_system('sldemo_fuelsys/To Controller')
Click the Rate Transition block. Get the current system.
ans = 'sldemo_fuelsys/To Controller'
Get Current System After Loading a Model
Open the model
f14 and get the current
ans = 'f14'
Load the model
Then get the current system.
ans = 'vdp'
vdp from memory, close it. In this example, the
current system becomes the open model,
ans = 'f14'
Introduced before R2006a