Is there a way to close (or hide) a Stateflow Editor programmatically?
I could not find any hint about this in the documentation or the net. The only way I know of is to close the model entirely, but I do not want this, as a changed model might need to be saved beforehand, so user interaction is needed.
Here's a simple example what I am currently doing:
sfr = sfroot;
% For simplicity I assume exactly one chart is found
chart = sfr.find('-isa', 'Stateflow.Chart');
% This can be used to display a chart
chart.view;
% How can the shown Stateflow Editor be closed again?
Now the chart
object has an Editor
property. But neither this nor the chart object itself have any useful member functions.
I am not bound on a specific Matlab release, so any help would be greatly appreciated!
There actually is a Matlab command called sfclose
which allows to close a Stateflow chart.
Without arguments the currently active chart is closed. To close a specific chart, its name has to be passed. The name consists of the full path excluding the model name. To close the chart model/sys1/sys2/chart
the command is as follows:
sfclose('sys1/sys2/chart')
Note: Unfortunately this command can only be found in the documentation if the phrase "sfclose" or "close chart" is searched. Anything else leads to unrelated results.