Hauptinhalt

sfprint

R2026b

Export Stateflow chart images

Description

sfprint exports the current chart to the default printer.

example

sfprint(source) exports the charts specified by source to the default printer.

example

sfprint(source,format) exports charts to files in the format specified by format. The file name matches the name of the chart, and the file extension matches the specified format.

example

sfprint(source,format,destination) exports charts to the location specified by destination.

example

sfprint(source,format,destination,wholeChart) exports the complete chart hierarchy or only the current view depending on the setting of wholeChart. Set wholeChart to 1 to export the complete chart hierarchy or 0 to export the current view.

example

Examples

collapse all

Export the currently displayed chart to the default printer.

sfprint

Export the shift_logic chart from the sf_car model to the default printer.

sfprint("sf_car/shift_logic");

Create sf_car_shift_logic.jpg in the current folder. The sf_car_shift_logic.jpg file contains the shift_logic chart from the sf_car model.

sfprint("sf_car/shift_logic","jpg")

Export the shift_logic chart from the sf_car model to the documentation/TransmissionLogic folder. If the folder does not exist before you call sfprint, the function returns an error.

sfprint("sf_car/shift_logic","pdf","documentation/TransmissionLogic")

Creates TransmissionLogic.pdf in the documentation folder. The folder must exist before calling sfprint.

Navigate to a region of interest in a large chart.

sfprint("sf_aircraft/FlightControl","png","DetailView",0)

Creates DetailView.png showing only the currently visible portion of the chart.

Copies the chart to the clipboard as an enhanced metafile. You can use enhanced metafiles with Windows® apps, including Microsoft® Office.

sfprint("sf_car/shift_logic","meta","clipboard")

Input Arguments

collapse all

Chart, model, subsystem, or block path, specified as a string scalar, character vector, a vector of string scalars, or a cell array of character vectors. To specify multiple paths, use a vector of string scalars or cell array of character vectors. To specify the current block or system of the model, use gcb (Simulink) or gcs (Simulink).

Example: sfprint(gcs) prints all the charts in the current system to the default printer.

Example: sfprint("sf_pool/Pool") prints the chart Pool in the sf_pool model to the default printer.

Data Types: string | char

Output format, specified as one of these values:

  • "jpg" — Export to a JPEG file.

  • "pdf" — Export to a PDF file.

  • "png" — Export to a PNG file.

  • "svg" — Export to a SVG file.

  • "tiff" — Export to a TIFF file.

  • "bitmap" — Save the chart image to the clipboard as a bitmap. You can use this option for Windows operating systems only.

  • "meta" — Save the chart image to the clipboard as an enhanced metafile. You can use this option for Windows operating systems only.

Example: sfprint("sf_car/shift_logic","jpg") prints the chart shift_logic chart in the sf_car model to a JPEG file named sf_car_shift_logic.jpg.

Example: sfprint("sf_bounce/BouncingBall","meta","myImage") prints the chart BouncingBall from the model sf_bounce as an enhanced metafile named myImage.emf.

Export destination, specified as one of these values:

  • "file" — Save to a file. The name of the file is the name of the chart or state and the file extension is the format. chart_name.file_extension.

  • "clipboard" — Copy to the clipboard.

  • "printer" — Send to the default printer. Use this option only with "ps" or "eps" formats.

  • "promptForFile" — Save to a file and specify the name and location. When you use this option, a dialog box opens..

Alternatively, specify the name, path, or name and path of the output file by using a string scalar or character vector.

Example: sfprint("sf_car/shift_logic","png","myFile") prints the chart shift_logic from the sf_car model to a PNG file named myFile.png in the current folder.

Example: sfprint(gcb,"pdf","promptForFile") prints all charts in the current block of the model in PDF format. A dialog box prompts you for the path and name of the output file for each chart.

Data Types: string | char

Export complete charts, specified as one of these options:

  • true or 1 — Export complete chart hierarchy.

  • false or 0 — Export current view only.

Example: sfprint(gcs,"png","file",0) prints the current view of the chart in the current system in PNG format using the default file name.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Tips

  • To generate higher-resolution images, maximize the Stateflow® Editor window before calling sfprint.

  • Use gcs to export all charts in the current system without specifying individual paths.

  • Set wholeChart to 0 to capture only the visible portions of large, complex charts.

  • To paste the highest-quality image into a Microsoft Office application, use the "meta" argument for the format input argument. Use meta format on Windows for highest quality when pasting into Microsoft Office applications.

  • To export individual subcharts within a chart hierarchy, or more advanced printing options, use Simulink® Report Generator™

Version History

Introduced before R2006a

See Also

(Simulink) | (Simulink) | | | |