Hauptinhalt

clearFlags

R2026b

Clear flags in Safety Analysis Manager spreadsheet and fault tree document elements

Since R2023b

Description

Spreadsheets

clearFlags(spreadsheet) clears the flags in the Safety Analysis Manager spreadsheet, spreadsheet.

example

clearFlags(spreadsheetCell) clears the flags in the spreadsheet cell, spreadsheetCell.

example

clearFlags(spreadsheetRow) clears the flags in the spreadsheet row, spreadsheetRow. (since R2024b)

example

Fault Tree Documents

clearFlags(faultTreeDocument) clears the flags in the Safety Analysis Manager fault tree document, faultTreeDocument.

example

clearFlags(event) clears the flags in the fault tree document event, event.

example

clearFlags(gate) clears the flags in the fault tree document gate, Gate.

example

clearFlags(failureModel) clears the flags in the fault tree document failure model, failureModel.

example

Examples

collapse all

Suppose you have a spreadsheet open in the Safety Analysis Manager that has two columns. The first is a check box column and the second is a text column. You want to write a script where, if the check box for a cell is not selected, the script marks the adjacent cell in the text column with a warning flag.

Retrieve the spreadsheet object.

mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;

Add warning flags to the cells in the second column if the adjacent cells in the check box column are not selected.

clearFlags(mySpreadsheet)
for n = 1:mySpreadsheet.Rows
  checkCell = getCell(mySpreadsheet,n,1);
  textCell = getCell(mySpreadsheet,n,2);
  if checkCell.Value == 0
    addFlag(textCell,"warning");
  end
end

Suppose you have a spreadsheet open in the Safety Analysis Manager that has two columns. The first is a check box column and the second is a text column. You want to write a script where, if the check box for a cell is not selected, you mark the adjacent cell in the text column with a warning flag, and clear the flag if the check box is selected.

Retrieve the spreadsheet object.

mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;

If the adjacent check box cell is selected, clear the cell in the text column of flags.

for n = 1:mySpreadsheet.Rows
  checkCell = getCell(mySpreadsheet,n,1);
  textCell = getCell(mySpreadsheet,n,2);
  if checkCell.Value == 1
    clearFlags(textCell)
  else
    addFlag(textCell,"warning");
  end
end

Since R2024b

Suppose you have a spreadsheet open in the Safety Analysis Manager that has two columns. The first is a check box column and the second is a text column. You want to write a script where, if the check box for a cell is not selected, you mark the row with a warning flag, and clear the flag if the check box is selected.

Retrieve the spreadsheet object.

mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;

If the adjacent check box cell is selected, clear the flags in the row. Otherwise, add a warning flag to the row.

for n = 1:mySpreadsheet.Rows
  checkCell = getCell(mySpreadsheet,n,1);
  flagRow = getRow(mySpreadsheet,n);
  if checkCell.Value == 1
    clearFlags(flagRow)
  else
    addFlag(flagRow,"warning");
  end
end

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 top-level gate and the first event.

addFlag(myGate,"check");
addFlag(myEvent1,"check");

Clear the flags in the fault tree document.

clearFlags(myFaultTreeDoc)

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 top-level gate and the first event.

addFlag(myGate,"check");
addFlag(myEvent1,"check");

Clear the flag from the event.

clearFlags(myEvent1)

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 top-level gate and the first event.

addFlag(myGate,"check");
addFlag(myEvent1,"check");

Clear the flag from the gate.

clearFlags(myGate)

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);

Each new event uses a unique failure model. Retrieve the failure model from each event.

myFailureModel1 = myEvent1.FailureModel;
myFailureModel2 = myEvent2.FailureModel;

Add a check flag to the first failure model, and a warning flag to the second failure model.

addFlag(myFailureModel1,"check");
addFlag(myFailureModel2,"warning");

Clear the flag from the first failure model.

clearFlags(myFailureModel1)

Input Arguments

collapse all

Spreadsheet in the Safety Analysis Manager, specified as a Spreadsheet object.

Cell in the Safety Analysis Manager spreadsheet, specified as a SpreadsheetCell object.

Row in the Safety Analysis Manager spreadsheet, specified as a SpreadsheetRow object.

Fault tree document in the Safety Analysis Manager, specified as a FaultTreeDocument object.

Event in the Safety Analysis Manager fault tree document, specified as an Event object.

Gate in the Safety Analysis Manager fault tree document, specified as a Gate object.

Failure model in the Safety Analysis Manager fault tree document, specified as a FailureModel object.

Version History

Introduced in R2023b

expand all