Main Content

removeReference

Remove references in Safety Analysis Manager spreadsheets

Since R2024b

Description

removeReference(spreadsheetCell,referencedCells) removes the references to the referenced cells, referencedCells, from the cell, spreadsheetCell.

The spreadsheets must be saved on the path.

example

removeReference(spreadsheetCell,indices) removes the references that have the indices, indices.

example

Examples

collapse all

Create two Safety Analysis Manager spreadsheets, and store each Spreadsheet object in a variable.

mySpreadsheet1 = safetyAnalysisMgr.newSpreadsheet;
mySpreadsheet2 = safetyAnalysisMgr.newSpreadsheet;

Add three rows to each spreadsheet by using the addRow function.

addRow(mySpreadsheet1,Count=3)
addRow(mySpreadsheet2,Count=3)

Add a text column and derived column that have custom labels to the mySpreadsheet2 spreadsheet by using the addColumn function.

addColumn(mySpreadsheet2,Count=2,Type=["text","derived"]...
  ,Label=["Check Box Column","Derived Column"])

Add a check box column that has a custom label to the mySpreadsheet1 spreadsheet by using the addColumn function.

addColumn(mySpreadsheet1,Type="checkbox",Label="Check Box Column")

Save the spreadsheets.

save(mySpreadsheet1,"spreadsheet1.mldatx")
save(mySpreadsheet2,"spreadsheet2.mldatx")

Retrieve the SperadsheetCell objects for the first cells in the first and second column in the mySpreadsheet1 spreadsheet and the first cell in the derived column in the mySpreadsheet2 spreadsheet.

myCell1(1) = getCell(mySpreadsheet1,1,1);
myCell1(2) = getCell(mySpreadsheet1,1,2);
myCell2 = getCell(mySpreadsheet2,1,"Derived Column");

Create a reference where the myCell2 cell references the myCell1 cells by using the addReference function.

addReference(myCell2,myCell1)

Remove the reference to the first referenced cell.

removeReference(myCell2,myCell1(1))

Create two Safety Analysis Manager spreadsheets, and store each Spreadsheet object in a variable.

mySpreadsheet1 = safetyAnalysisMgr.newSpreadsheet;
mySpreadsheet2 = safetyAnalysisMgr.newSpreadsheet;

Add three rows to each spreadsheet by using the addRow function.

addRow(mySpreadsheet1,Count=3)
addRow(mySpreadsheet2,Count=3)

Add a text column and derived column that have custom labels to the mySpreadsheet2 spreadsheet by using the addColumn function.

addColumn(mySpreadsheet2,Count=2,Type=["text","derived"]...
  ,Label=["Check Box Column","Derived Column"])

Add a check box column that has a custom label to the mySpreadsheet1 spreadsheet by using the addColumn function.

addColumn(mySpreadsheet1,Type="checkbox",Label="Check Box Column")

Save the spreadsheets.

save(mySpreadsheet1,"spreadsheet1.mldatx")
save(mySpreadsheet2,"spreadsheet2.mldatx")

Retrieve the SperadsheetCell objects for the first cells in the first and second column in the mySpreadsheet1 spreadsheet and the first cell in the derived column in the mySpreadsheet2 spreadsheet.

myCell1(1) = getCell(mySpreadsheet1,1,1);
myCell1(2) = getCell(mySpreadsheet1,1,2);
myCell2 = getCell(mySpreadsheet2,1,"Derived Column");

Create a reference where the myCell2 cell references the myCell1 cells by using the addReference function.

addReference(myCell2,myCell1)

Remove the second reference from the cell, myCell2.

removeReference(myCell2,2)

Input Arguments

collapse all

Spreadsheet cell to add the reference to, specified as a SpreadsheetCell object. The cell must be in a derived column. For more information on derived columns, see Define Derived Values and Define the Derived Column Formula.

Referenced cells, specified as a SpreadsheetCell object array. The cells can exist in the same or different Safety Analysis Manager spreadsheets than spreadsheetCell.

Reference indices, specified as a vector of positive integers.

Example: removeReference(myCell,[1,3]) removes the references from the spreadsheet cell, myCell, that have the indices 1 and 3.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64

Version History

Introduced in R2024b