cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar

Obtaining a Data Matrix

Started ‎11-08-2022 by
Modified ‎11-08-2022 by
View Fullscreen Exit Fullscreen

You can get numeric data from a data column by sending either the Get Values message or the Get As Matrix message to the column. The result of both of these is a column vector, or, a matrix that contains only a single column. You can also get the numeric data from all the numeric data columns in a data table by sending the Get As Matrix message to the data table. If there are columns with non-numeric data in the table, they'll be ignored. Let's suppose that the variable m is storing a matrix. To obtain elements from a matrix, you use subscripts that are enclosed in square brackets appended to the variable name. So, the first form of a subscript uses the row and column coordinates of the element. The second form of a subscript uses the row-wise index from the first to the last element. In other words, it's the position of the element if the matrix is treated as a single row. You can obtain an entire column using the first subscript form by setting the row coordinate to zero and specifying the column coordinate. Likewise, you can obtain an entire row by setting the column coordinate to zero and specifying the row coordinate. An empty matrix has no elements--it's similar to an empty list, and it can be a useful starting point for some situations. You can use the empty matrix to delete rows or columns in a matrix by assigning the empty matrix to the entire row or column specified by the subscripted matrix. You can also manipulate matrices by concatenating them row-wise or column-wise, using the horizontal or vertical matrix concatenate operators. In addition to using subscripts with matrices, you can also use subscripts with data columns. You can obtain the value in a cell or you can assign a value to a cell using subscripts.