Main Content

Spreadsheet

Spreadsheet in Safety Analysis Manager

Since R2023b

Description

Spreadsheet objects represent spreadsheets in the Safety Analysis Manager. Use Spreadsheet objects to configure spreadsheets you use for safety analyses.

Creation

To create a Spreadsheet object:

Properties

expand all

This property is read-only.

Directory of the spreadsheet file, returned as a character vector.

Example: 'C:/Documents/mySpreadsheet'

Data Types: char

This property is read-only.

Number of rows in the spreadsheet in the Safety Analysis Manager, returned as an integer. To add and delete rows to the spreadsheet, use the addRow and deleteRow functions.

Data Types: uint64

This property is read-only.

Number of columns in the spreadsheet in the Safety Analysis Manager, returned as an integer. To add and delete columns to the spreadsheet, use the addColumn and deleteColumn functions.

Data Types: uint64

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

Data Types: char | string

Object Functions

acceptAllChangesAccept detected changes to linked artifacts in Safety Analysis Manager
addCallbackAdd custom callback to Safety Analysis Manager spreadsheets
addColumnAdd column to spreadsheet in Safety Analysis Manager
addDocumentAttributeAdd document attribute to spreadsheet in Safety Analysis Manager
addRowAdd row to spreadsheet in Safety Analysis Manager
closeClose spreadsheet in Safety Analysis Manager
clearFlagsClear flags in Safety Analysis Manager spreadsheet
deleteCallbackDelete custom callback from Safety Analysis Manager spreadsheets
deleteColumnDelete column in spreadsheet in Safety Analysis Manager
deleteDocumentAttributeDelete document attributes in spreadsheet in Safety Analysis Manager
deleteRowDelete row in spreadsheet in Safety Analysis Manager
detectChangesDetect changes to linked artifacts in Safety Analysis Manager document
exportExport Safety Analysis Manager spreadsheet to Excel
getCallbackRetrieve spreadsheet callback code in Safety Analysis Manager
getCellRetrieve spreadsheet cells
getChangesGet changed artifacts linked to artifacts in Safety Analysis Manager
getColumnLabelsRetrieve column labels in spreadsheet in Safety Analysis Manager
getColumnTypesRetrieve column types in spreadsheet in Safety Analysis Manager
getDocumentAttributeRetrieve document attribute values in spreadsheet in Safety Analysis Manager
getDocumentAttributePropertiesRetrieve document attribute properties in Safety Analysis Manager spreadsheet
getFlagsRetrieve flags from Safety Analysis Manager spreadsheets
getRowRetrieve spreadsheet rows
isCallbackEnabledDetermine whether custom callbacks are enabled
renameCallbackRename custom callbacks in Safety Analysis Manager spreadsheets
renameDocumentAttributeRename document attributes in spreadsheets
runAnalysisExecute callback script on Safety Analysis Manager spreadsheet
saveSave spreadsheet in Safety Analysis Manager
saveTemplateSave spreadsheet in Safety Analysis Manager as a template
setCallbackAssign code to Safety Analysis Manager spreadsheet callback
setColumnFormulaSpecify derived column formulas in spreadsheet in Safety Analysis Manager
setColumnLabelAdjust column label of spreadsheet in Safety Analysis Manager
setDocumentAttributeSet document attributes in spreadsheet in Safety Analysis Manager
setValueWrite values to spreadsheet cells

Examples

collapse all

Create a new spreadsheet in the Safety Analysis Manager.

mySpreadsheet = safetyAnalysisMgr.newSpreadsheet
mySpreadsheet = 

  Spreadsheet with properties:

    FileName: ''
        Rows: 1
     Columns: 1
 Description: ''

Suppose that you load only one spreadsheet in the Safety Analysis Manager. The spreadsheet file is named mySpreadsheet, is saved in C:\myFolder, and contains two rows and two columns. Retrieve the Spreadsheet object of the open spreadsheet in the Safety Analysis Manager.

mySpreadsheet = safetyAnalysisMgr.getOpenDocuments
mySpreadsheet = 

  Spreadsheet with properties:

    FileName: 'C:\myFolder\mySpreadsheet.mldatx'
        Rows: 2
     Columns: 2
 Description: ''

Create a new spreadsheet in the Safety Analysis Manager.

mySpreadsheet = safetyAnalysisMgr.newSpreadsheet;

Add three rows to the spreadsheet.

addRow(mySpreadsheet,Count=3)

Add a text and check box column to the spreadsheet.

addColumn(mySpreadsheet)
addColumn(mySpreadsheet,Type="checkbox")

Update the column labels.

setColumnLabel(mySpreadsheet,"text column",1);
setColumnLabel(mySpreadsheet,"new text column",2);
setColumnLabel(mySpreadsheet,"checkbox column",3);

Save the spreadsheet with the name myNewSpreadsheet to the current folder.

save(mySpreadsheet,"myNewSpreadsheet.mldatx")

Close the spreadsheet.

close(mySpreadsheet);

Limitations

  • The Spreadsheet objects that you use in derived column formulas are read-only.

Version History

Introduced in R2023b

expand all