You can find out which blocks have continuous states with the following 2 ways after setting the solver as "Variable Steps" which you used to run without error.
1.
Use the command "Simulink.BlockDiagram.getInitialState".
Here is an example code:
open_system(docpath(fullfile(docroot, 'toolbox','simulink','examples','ex_execution_order')))
model = gcs;
states = Simulink.BlockDiagram.getInitialState(model);
if ~isempty(states)
for n=1:length(states.signals)
if strcmp(states.signals(n).label,'CSTATE')
states.signals(n).blockName
end
end
end
This is the result when running the above code:
ans =
'ex_execution_order/car dynamics/Integrator'
2.
Use sldebug('model') and then type "states".
For example:
>> open_system(docpath(fullfile(docroot, 'toolbox','simulink','examples','ex_execution_order')))
>> sldebug(gcs)
%----------------------------------------------------------------%
[TM = 0 ] simulate(ex_execution_order)
(sldebug @0): >> states
Continuous States for 'ex_execution_order':
Idx Value (system:block:element Name 'BlockName')
- 0. 0 (0:0:0 CSTATE 'ex_execution_order/car dynamics/Integrator')*
Discrete States for 'ex_execution_order':
Idx Value (system:block:element Name 'BlockName')
0 0 (1:0:0 DSTATE 'ex_execution_order/discrete cruise controller/Unit Delay1')
1 0 (1:5:0 DSTATE 'ex_execution_order/discrete cruise controller/Unit Delay')
(sldebug @0): >> quit
Best Answer