How do I capture a Stateflow chart image into the clipboard without the beige background color and chart information string?

8 views (last 30 days)
From a Stateflow chart, I click "File" -> "Print Current View" -> "To Clipboard". The image place in the clipboard has a beige background color. Is there a way to copy the chart without the beige background color?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
There are two ways to print a Stateflow chart without the beige background color.
Option 1, From the Stateflow UI
1. Select the "Edit" -> "Style" menu.
2. Click on the background of the example chart that will appear.
3. Choose white (or whatever color you want), and click OK to dismiss the color picker.
4. Click apply and the chart will turn white.
5. Now, you can print without the beige background.
Option 2, From the Stateflow API
First, get a handle to the chart. The following code will work for the simple case of one chart open, see Stateflow API documentation for full details.
myChart = find(sf, '-isa', 'Stateflow.Chart');
oldColor = get(myChart, 'ChartColor');
set(myChart, 'ChartColor', [1 1 1]); % RGB values for white
%%Now, print the chart
shh = get(0,'ShowHiddenHandles');
set(0,'ShowHiddenHandles','on');
open_system(myChart.Path)
print(gcf)
%%reset original state
close_system(myChart.Path)
set(0,'ShowHiddenHandles',shh);
set(myChart, 'ChartColor', oldColor);

More Answers (0)

Categories

Find more on Environment and Settings in Help Center and File Exchange

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!