getCell
Description
returns the cell in the open spreadsheet file cell
= getCell(spreadsheet
,row
,column
)spreadsheet
that is in
the specified row and column.
returns the cell that spreadsheet row object, cell
= getCell(spreadsheetRow
,column
)spreadsheetRow
has in the
specified column, column
. (since R2024b)
Examples
Get Cell in Specified Row and Column
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.
myCell = getCell(mySpreadsheet,2,2);
Get Cell in Column with Specified Label
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
.
myCell = getCell(mySpreadsheet,2,"myColumn");
Get Cell in Specified Row by Using SpreadsheetRow
Object
Since R2024b
Suppose that only one spreadsheet is loaded in the Safety
Analysis Manager. The spreadsheet has two columns and two cells. Before you get
the cell, you want to add a description to the row. Retrieve the
Spreadsheet
object of the spreadsheet.
mySpreadsheet = safetyAnalysisMgr.getOpenDocuments;
Retrieve the last row as a SpreadsheetRow
object.
myRow = getRow(mySpreadsheet,mySpreadsheet.Rows);
Add a description to the row.
myRow.Description = "This is a row description."
Get the cell in the row in the second column, and assign its value to the description of the row.
myCell = getCell(myRow,2); myCell.Value = myRow.Description;
Input Arguments
spreadsheet
— Spreadsheet in Safety Analysis Manager
Spreadsheet
object
Spreadsheet in the Safety Analysis Manager, specified as a
Spreadsheet
object.
row
— Row location of cell
positive integer
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
— Column location in spreadsheet
positive integer | string scalar | character vector
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
spreadsheetRow
— Row in Safety Analysis Manager spreadsheet
SpreadsheetRow
object
Since R2024b
Row in the Safety Analysis Manager spreadsheet, specified
as a SpreadsheetRow
object.
Output Arguments
cell
— Cell in spreadsheet
SpreadsheetCell
object
Cell in the spreadsheet, returned as a SpreadsheetCell
object.
Version History
Introduced in R2023bR2024b: SpreadsheetRow
support
Retrieve spreadsheet cells in spreadsheet rows by using the getCell
function on SpreadsheetRow
objects.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)