Main Content

getCell

Retrieve spreadsheet cells

Since R2023b

Description

example

cell = getCell(spreadsheet,row,column) returns the cell in the open spreadsheet file spreadsheet in the specified row and column.

Examples

collapse all

Suppose that only one spreadsheet is loaded in the Safety Analysis Manager. The spreadsheet has two rows and two columns. Retrieve the Spreadsheet object of the spreadsheet.

mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;

Retrieve the cell in the second row and the second column.

value = getCell(mySpreadsheet,2,2);

Suppose that only one spreadsheet is loaded in the Safety Analysis Manager. The spreadsheet has two rows and two columns. The columns are labeled myColumn and myOtherColumn. Retrieve the Spreadsheet object of the spreadsheet.

mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;

Retrieve the cell in the second row and the column labeled myColumn.

value = getCell(mySpreadsheet,2,"myColumn");

Input Arguments

collapse all

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

Row location of the cell in the spreadsheet, specified as a positive integer. The row index of the topmost row of the spreadsheet is 1.

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

Column location in the spreadsheet, specified as a positive integer, string scalar, or character vector. Use a positive integer to specify the column index, and use a string scalar or character vector to specify the column by its label. The index starts of leftmost column of the spreadsheet is 1.

To find the number or columns in the spreadsheet, retrieve the Columns property of the Spreadsheet object used in spreadsheet. To find the column labels, use the getColumnLabels function on the Spreadsheet object.

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

Output Arguments

collapse all

Cell in the spreadsheet, returned as a SpreadsheetCell object.

Version History

Introduced in R2023b