Dataset get
Contents |
Purpose
Get field/property values from a DataSet object.
Synopsis
- value = get(x,'field',vdim,vset);
Description
dataset/get is a depreciated function. See dataset/subsref for the preferred method of extracting values from a DataSet object.
The I/O for GET depends on whether the data are of class double or cell. The more common usage is when the data are of class double and this is discussed under subheading 1. In this case the data can be contained in a double array of 2 or higher modes/dimensions. Differences for data of class cell are discussed under subheading 2.
1) The following is used when the data field is a fixed-size array (.type = 'data' or 'image')
- value = get(x,'field');
For DataSet x this returns the value (value) of the property 'field'. This syntax is used for the following fields:
name: value is a char vector. author: value is a char vector. date: value is a 6 element vector (see CLOCK). moddate: value is a 6 element vector (last modified date). type: value is either 'data' or 'image'. data: value is a double array. description: value is a char array. userdata: user defined. description: value is a char array. history: cell array of char (e.g. char(get(h,'history'))) datasetversion: dataset object version.
Example: get(x,'data(:,1)') %Extracts the first column of the double array.
- value = get(x,'field',vdim);
This syntax is used with the following fields:
include: value is row vector of indices for mode vdim.
- value = get(x,'field',vdim,vset);
Returns the value value for the property 'field' for the specified dimension/mode vdim and optional set vset {default: vset=1}. E.g. vset is used when multiple sets of labels are present in x. This syntax is used for the following fields:
label: value is a char array with size(x.data,vdim) rows. labelname: value is a char row vector. axisscale: value is a row vector with size(x.data,vdim) real elements. axisscalename: value is a char row vector. title: value is a char row vector. titlename: value is a char row vector. class: value is a row vector with size(x.data,vdim) integer elements. classname: value is a char row vector.
2) For cases when the data set consists of multiple matrices of variable length (e.g. each data matrix has the same number of columns but different numbers of rows: N1,ixNm, m = 2, ..., M; and N1,i≠N1,j for i≠j) the field '.data' can contain a cell array and the field '.type' is 'batch'. The following are specific to GET when the data field is of class cell (.type = 'batch'). For fields not listed below use the I/O syntax listed under subheading 1.
- value = get(x,'field');
Returns the value value of the property 'field'. This syntax is used for the following fields:
type: value is 'batch'. data: value is a cell array (extracts entire data set).
Example: get(x,'data{3}(:,1)') %extracts the first column of the third cell get(x,'data{2}') %extracts the entire contents of the second cell.
- value = get(x,'field',vdim,vset);
Returns the value value of the property 'field' for the specified dimension/mode vdim and optional set vset {default: vset=1}. E.g. vset is used when multiple sets of labels are present in x. This syntax is used for the following fields: axisscale: value is a row vector with size(x.data,vdim) real elements. For all but the first mode the I/O syntax is identical to that for data of class double discussed under subheading 1. For mode 1 vdim is either scalar value 1 (i.e. vdim=1), or a two element vector with vdim(1)=1 and vdim(2)=i where i = 1, ..., N1. Example: get(x,'axisscale',1,2) extracts the entire cell array of axis scales for mode 1 from the second set get(x,'axisscale',[1 3]) extracts the axis scales for mode 1 of the 3rd cell from the first set