Stateflow.exportAsClass - Export MATLAB class for standalone chart - MATLAB (original) (raw)
Main Content
Export MATLAB class for standalone chart
Syntax
Description
Stateflow.exportAsClass([source](#mw%5F51655b47-928d-4f35-93a0-e52c2ea8709a))
saves a standalone Stateflow® chart as a MATLAB® class file in the current folder. The saved file has the same name as the chart. For example, if source
is chart.sfx
, the function saves the MATLAB class in the file chart.m
.
Stateflow.exportAsClass([source](#mw%5F51655b47-928d-4f35-93a0-e52c2ea8709a),[destination](#mw%5Fd88b2a81-0194-4336-a2df-2239faa2b31c))
saves the chart as a MATLAB class file in the folder destination
.
Note
The MATLAB class produced by Stateflow.exportAsClass
is intended for debugging purposes only, and not for production use or manual modification. For more information, see Tips.
Examples
Save Stateflow chart chart.sfx
as the MATLAB class file chart.m
in the current folder.
Stateflow.exportAsClass("chart.sfx");
Save Stateflow chart chart.sfx
, which is located in folderdir1
, as the MATLAB class file chart.m
in the current folder.
Stateflow.exportAsClass(fullfile("dir1","chart.sfx"));
Save Stateflow chart chart.sfx
, which is located in the current folder, as the MATLAB class file chart.m
in the folderdir2
.
Stateflow.exportAsClass("chart.sfx","dir2");
Input Arguments
Path and file name of a standalone chart, specified as a string scalar or character vector. You can use the absolute path from the root folder or the relative path from the current folder. Standalone charts have the extension .sfx
.
Data Types: char
| string
Path of the destination folder for the MATLAB class file, specified as a string scalar or character vector. You can use the absolute path from the root folder or the relative path from the current folder. If not specified, the function saves the MATLAB script file in the current folder.
Data Types: char
| string
Tips
- Use the code produced by
Stateflow.exportAsClass
to debug run-time errors that are otherwise difficult to diagnose. For example, suppose that you encounter an error while executing a Stateflow chart that controls a MATLAB application. If you export the chart as a MATLAB class file, you can replace the chart with the class in your application and diagnose the error by using the MATLAB debugger.
Note
Error messages produced by the MATLAB class point to different line numbers than the corresponding error messages produced by the Stateflow chart. - When you execute the MATLAB class produced by
Stateflow.exportAsClass
, the Stateflow Editor does not animate the original chart.
Version History
Introduced in R2019b