Main Content

clearFlags

Clear flags in Safety Analysis Manager spreadsheet

Since R2023b

Description

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

example

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

example

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

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

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.

Since R2024b

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

Version History

Introduced in R2023b

expand all