Main Content

addFlag

Add flag to Safety Analysis Manager spreadsheet cell or row

Since R2023b

Description

addFlag(spreadsheetCell,flagType) adds a flag to the cell, spreadsheetCell that has the flag flagType, in a Safety Analysis Manager spreadsheet.

example

addFlag(spreadsheetRow,flagType) adds a flag to the specified Safety Analysis Manager spreadsheet row, spreadsheetRow. (since R2024b)

example

addFlag(___,Name=Value) adds a flag to the spreadsheet cell or row using one or more name-value arguments.

example

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.

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

Since R2024b

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 SpreadsheetRow objects for the rows

for n = 1:mySpreadsheet.Rows
  myRows(n) = getRow(mySpreadsheet,n);
end

Add a warning flag to the first and second rows.

addFlag(myRows(1),"warning")
addFlag(myRows(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",Description="This is a warning.")
addFlag(myCells(2),"warning",Description="This is another warning.")

Input Arguments

collapse all

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.

Type of flag, specified as one of these values:

ValueDescription
"error"

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

"warning"

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

"check"

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

Data Types: enumeration

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: addFlag(myCell,"check",Description="This indicates a check.") adds a check flag to the cell, myCell, that has a description.

Flag description, specified as a string scalar or character vector.

Data Types: char | string

Flag tag, specified as a string scalar or character vector.

Data Types: char | string

Version History

Introduced in R2023b

expand all