Safety Analysis Manager
Description
Use the Safety Analysis Manager app to create documents used for safety analyses, such as Failure Mode and Effects Analyses (FMEAs) and Functional Hazard Assessments (FHAs). Link elements in spreadsheets to model artifacts such as requirements and faults.
![](safety_analysis_manager_browser.png)
Open the Safety Analysis Manager App
Simulink® Toolstrip: On the Apps tab, under Model Verification, Validation, and Test, click Safety Analysis Manager.
Fault Analyzer tab: In the Management section, click Safety Analysis Manager.
Examples
Create New Spreadsheets
You can create a new spreadsheet by creating an empty spreadsheet or using a template that has specified columns and column types. To create a spreadsheet:
In the Safety Analysis Manager, in the File section, click New.
Create an empty spreadsheet by clicking Empty Spreadsheet. Alternatively, open a template in the From Template section. If you select Custom Template, you must select a MLDATX template file.
Open Spreadsheets
To open a spreadsheet, in the File section, click Open. You can also press Ctrl+O if you are already in a spreadsheet. You must select a MLDATX spreadsheet file.
To create a spreadsheet using external files, such as an Excel® file, in the File section, click Import. For more information on importing spreadsheets from Excel, see Import Excel Files into the Safety Analysis Manager.
Add Rows and Columns to a Spreadsheet
To add a row to a spreadsheet, in the Spreadsheet section, click Add Row. To add a new column, in the Spreadsheet section, click Add Column.
Rows automatically adjust to the height of the content in their cells. You can adjust the width of the columns manually.
To delete a column, click on the column label and, in the Edit section, click Delete. To delete a row, click on the row index and, in the Edit section, click Delete.
Hide Columns
Since R2024a
By default, all columns are visible in Safety Analysis Manager spreadsheets. To hide columns:
Open an existing spreadsheet or create a new spreadsheet with at least two columns.
In the Spreadsheet section, click View Columns.
In the View Columns window, clear the columns that you want to hide and click OK.
Hidden columns retain their index, and you can still access their content by using
programmatic options. For more information on programmatic options, see Spreadsheet
and Create and Configure Safety Analysis Manager Spreadsheets Programmatically.
Safety Analysis Manager spreadsheets must have at least one visible column.
Create a Check Box Column
By default, the Add Column button creates a text column. You can specify the type of column as you create it or after you add it.
To create a new check box column:
Open an existing spreadsheet or create a new spreadsheet.
In the Spreadsheet section, click Add Column.
Right-click the column label to access the context menu and click Column Type > Checkbox.
You can also change the column type after you set it from the context menu.
Create an Enumeration Column
To create an enumeration column, define an enumeration class definition file on path. See Define Enumeration Classes. Then, specify an enumeration column and assign the enumeration class to the column. The entries in the column are limited to the entries in the class definition.
For example, to create an enumeration column that specifies a day out of the week:
In a new MATLAB® file, define an enumeration class named
WeekDays
.classdef WeekDays enumeration Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday end end
Save the class definition on your file path with the name
WeekDays.m
.In the Safety Analysis Manager, open an existing spreadsheet or create a new spreadsheet.
In the Spreadsheet section, click Add Column.
Right-click the column label to access the context menu and click Column Type > Enumeration.
In the Enumeration Class window, enter the name of the class,
WeekDays
, and click OK.
In the column, double-click a cell to expand the available values.
Click the value to set the cell value.
Create a Derived Column
Suppose you have a spreadsheet with two text columns, Column1 and Column2, and you want to create a column that takes the strings in those columns and creates a new string. Create a derived column that uses MATLAB.
In the Spreadsheet section, click Add Column.
Right-click the column label to access the context menu and click Column Type > Derived.
Right-click the column label and click Edit Formula.
In the Column Formula Editor window, retrieve the adjacent values of the column cells by using the
sfa_columnValue
operator, and assigning the new string to the cell by using thesfa_derivedCell
keyword:x = sfa_columnValue("Column1"); y = sfa_columnValue("Column2"); sfa_derivedValue = x + " " + y;
Close the Column Formula Editor window. The column now derives its cells from the adjacent cell values in Column1 and Column2.
Add a Description to Spreadsheets and Cells
To add a description to a spreadsheet:
Open or create a new Safety Analysis Manager spreadsheet.
In the Properties pane, in the Spreadsheet tab, add a description in the Description section.
To add a description to a cell in a spreadsheet:
Click a cell in the spreadsheet.
In the Properties pane, in the Cell tab, add a description in the Description section.
Link Cell to Fault
If you have Requirements Toolbox™, you can link spreadsheet cells to other model artifacts, including blocks, test cases, and faults. For example, to link a cell to a fault:
In a model with faults, in the Apps tab, click Fault Analyzer.
In the Fault Analyzer tab, in the View section, click Fault Table.
Click the Fault tab.
Expand the model element list and click the fault that you want to link.
In a saved Safety Analysis Manager spreadsheet that contains at least one cell, click the cell.
In the Links section, click Add Link > Link to Selection in Fault Table.
For more information on linking cells to other model artifacts, see Link Safety Analysis Manager Cells to Linkable Items.
Find Text in Cells
To find cells containing specified text:
Open an existing spreadsheet or create a new spreadsheet.
In the Search section, click Find or press Ctrl+F. The search bar opens.
Enter the text that you want to find. You can specify if the search is case sensitive and if it searches for only whole cell content matches. The search highlights the matching text in the cells in yellow.
Create Callbacks
You can use callbacks to run MATLAB scripts when you do tasks like loading, analyzing, saving, or closing a document. To create a callback:
Open a document.
In the Analyze section, click Edit Callbacks. The Callbacks Editor window opens.
Enter your code in one or more of these callback types:
Callback Type When Callback Executes PreLoadFcn Before the spreadsheet loads PostLoadFcn After the spreadsheet loads AnalyzeFcn When you click Analyze Spreadsheet or press F5 PreSaveFcn Before the spreadsheet is saved PostSaveFcn After the spreadsheet is saved CloseFcn Before the spreadsheet is closed Exit the Callbacks Editor window to save the callbacks.
For more information, see Write Callbacks to Analyze Safety Analysis Manager Documents.
The AnalyzeFcn callback type includes a default callback that is always enabled. You can also add custom AnalyzeFcn callbacks that you can enable or disable. (since R2024a) See Create and Select Custom Callbacks for Safety Analysis Manager Documents.
Filter and Clear Diagnostics
The Diagnostics pane lists diagnostics from the scripts that you create in callbacks. The pane displays the same types of diagnostic messages that appear in the Diagnostic Viewer in Simulink models. See Diagnostic Viewer. You can use filters to display errors, warnings, or information.
At the bottom of the Safety Analysis Manager, expand the Diagnostics pane by clicking the Expand Bottom button
.
To display:
Information — Click the Show/Hide information button
.
Warnings — Click the Show/Hide warnings button
.
Errors — Click the Show/Hide errors button
.
The pane displays the number of each kind of diagnostic message next to the corresponding button. Each message links to the document that contains the diagnostic.
To clear the diagnostics, click the Clear all
diagnostics button .
Export Diagnostics
After generating diagnostics, you can export them to a separate TXT file. To export diagnostics:
At the bottom of the Safety Analysis Manager, expand the Diagnostics pane by clicking the Expand Bottom button
.
Click the Export diagnostics button
.
Save the diagnostics as a TXT file.
Export Spreadsheet to Excel
To export a spreadsheet to Excel:
Open an existing spreadsheet.
In the Share section, click Export.
Save the file. When running Simulink in Windows®, you can save the file with the
.xls
,.xlsb
,.xlsm
, or.xlsx
extension. When running Simulink in macOS or Linux®, you can save the file with the.xls
,.xlsm
, or.xlsx
extension.
Create Document Attributes
To create document attributes:
Open an existing spreadsheet or create a new spreadsheet.
In the Properties pane, in the Spreadsheet tab, in the Document attributes section, click the Add new document attribute button
.
To delete a document attribute, select the attribute and click the Delete document
attribute button .
Related Examples
- Create Spreadsheets in the Safety Analysis Manager
- Create and Register Templates in the Safety Analysis Manager
- Import Excel Files into the Safety Analysis Manager
- Write Callbacks to Analyze Safety Analysis Manager Documents
- Create and Select Custom Callbacks for Safety Analysis Manager Documents
- Create and Configure Safety Analysis Manager Spreadsheets Programmatically
Programmatic Use
safetyAnalysisMgr.openManager
safetyAnalysisMgr.openManager
opens the Safety Analysis
Manager app.
Version History
Introduced in R2023bR2024a: Create custom callbacks in Safety Analysis Manager spreadsheets
If you want to create a callback that you can turn on or off when you analyze your Safety Analysis Manager spreadsheets, create custom callbacks. For more information on how to create custom callbacks, see Create and Select Custom Callbacks for Safety Analysis Manager Documents and Analyze Spreadsheet with Custom Callbacks.
R2024a: Hide columns in Safety Analysis Manager spreadsheets
Hide columns in Safety Analysis Manager spreadsheets to condense the spreadsheet without removing content.
See Also
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)