Hauptinhalt

DocumentFlag

R2026b

Flags in Safety Analysis Manager

Since R2023b

Description

DocumentFlag objects represent flags in Safety Analysis Manager document elements. Use DocumentFlag objects to configure flags you use for safety analyses.

Creation

To create a DocumentFlag object:

  • Use the getFlags function to retrieve the flags in a Safety Analysis Manager spreadsheet, spreadsheet row, or spreadsheet cell.

  • Use the addFlag function to add flags to a Safety Analysis Manager spreadsheet row or spreadsheet cell (since R2026a).

  • Use the getFlags function to retrieve the flags in these Safety Analysis Manager fault tree document elements (since R2026b):

    • Fault tree documents

    • Events

    • Gates

    • Failure models

  • Use the addFlag function to add flags to a Safety Analysis Manager fault tree document event, gate, or failure model (since R2026b).

Properties

expand all

This property is read-only.

Type of flag, represented as one of these values:

ValueDescription
'error'

An error flag. Cells and rows with an error flag display the error icon .

'warning'

A warning flag. Cells and rows with a warning flag display the warning icon .

'check'

A check flag. Cells and rows with a check flag display the check icon .

To specify this property, define the flagType argument when you use the addFlag function.

Data Types: enumeration

This property is read-only.

Description of the flag, represented as a character vector.

To specify this property, define the Description name-value argument when you use the addFlag function.

Data Types: char

This property is read-only.

Flag tag, represented as a character vector.

To specify this property, define the Tag name-value argument when you use the addFlag function.

Data Types: char

This property is read-only.

Document element in the Safety Analysis Manager spreadsheet or fault tree document that contains the flag, represented as a SpreadsheetCell (since R2023b) SpreadsheetRow (since R2024b), Event (since R2026b), Gate (since R2026b), or FailureModel (since R2026b) object.

Object Functions

clearClear Safety Analysis Manager document flag

Examples

collapse all

Create a new Safety Analysis Manager spreadsheet.

mySpreadsheet = safetyAnalysisMgr.newSpreadsheet;

Add two text columns and two rows to the spreadsheet.

addRow(mySpreadsheet,Count=2)
addColumn(mySpreadsheet,Count=2)

Retrieve the SpreadsheetCell objects for the cells in the second column.

for n = 1:mySpreadsheet.Rows
  myCells(n) = getCell(mySpreadsheet,n,2);
end

Add a warning flag to the cells in the first and second row of the second column. Retrieve the flags by assigning variables to the output argument of the addFlag function.

myFlag = addFlag(myCells(1),"warning");
myFlag2 = addFlag(myCells(2),"warning");

Create a new Safety Analysis Manager spreadsheet.

mySpreadsheet = safetyAnalysisMgr.newSpreadsheet;

Add two text columns and two rows to the spreadsheet.

addRow(mySpreadsheet,Count=2)
addColumn(mySpreadsheet,Count=2)

Retrieve the SpreadsheetCell objects for the cells in the second column.

for n = 1:mySpreadsheet.Rows
  myCells(n) = getCell(mySpreadsheet,n,2);
end

Add a warning flag to the cells in the first and second row of the second column.

addFlag(myCells(1),"warning");
addFlag(myCells(2),"warning");

Retrieve the DocumentFlag objects from the cells as an array of DocumentFlag objects.

myFlags = getFlags(myCells(1));

Since R2026b

Create a new Safety Analysis Manager fault tree document.

myFaultTreeDoc = safetyAnalysisMgr.newDocument("fault-tree");

Retrieve the fault tree from the document.

myFaultTree = myFaultTreeDoc(1).FaultTrees(1);

New fault trees contain one top-level gate. Retrieve the gate.

myGate = myFaultTree.Gates(1);

Add two basic events to the gate.

myEvent1 = createEvent(myGate);
myEvent2 = createEvent(myGate);

Add a check flag to the first event, and a warning flag to the second event. Retrieve the flags by assigning variables to the output argument of the addFlag function.

myFlag1 = addFlag(myEvent1,"check");
myFlag2 = addFlag(myEvent2,"warning");

Limitations

  • When you close the spreadsheet or fault tree document that contains the flag, the Safety Analysis Manager deletes the flag, even if you saved the document.

Version History

Introduced in R2023b

expand all