Dataset set

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Set field/property values for a DataSet object.

Synopsis

set(x,'field',value,vdim,vset)

Description

dataset/set is a depreciated function. See dataset/subsasgn for the preferred method of assigning values to a DataSet object.

The I/O for SET 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 of class double (.type = 'data' or 'image').

  • set(x) displays all field names and possible values for the input x which is a DataSet.
  • set(x,'field' ) displays the possible values for input 'field'.
  • set(x,'field',value) sets the field for a DataSet object to value.

This syntax is used for the following fields:

name:  char vector or cell of size 1 with char contents.
author:  char vector or cell of size 1 with char contents.
date:  6 element vector (see CLOCK).
type:  field '.data' must not be empty to set '.type', can have value 'data' or 'image'.
data:  double array.
description:  char array or cell with char contents.
userdata:  filled with user defined data.
  • set(x,'field',value,vdim)

This syntax is used for the following fields:

include:  row vector of max length size(x.data,vdim) e.g. 1:size(x.data,vdim).
  • set(x,'field',value,vdim,vset)

sets the field for a DataSet object to value for the specified dimension vdim and optional set vset {default: vset=1}, e.g. the vset input allows for multiple sets of labels to be used. The field '.data' must not be empty to set the values. This syntax is used for the following fields:

label:  character or cell array with size(x.data,vdim) rows containing labels for the vdim dimension/mode.
labelname:  row vector of class char or 1 element cell containing a name for the label set.
axisscale:  vector of class double (real elements) with size(x.data,vdim) elements. Each contains an axis scale to plot against for the vdim mode (e.g. x.axisscale{2,1} is a numerical scale for columns, and x.axisscale{1,1} is a numerical scale for rows).
axisscalename:  row vector of class char or 1 element cell containing a name for the axis scale.
title:  row vector of class char or 1 element cell containing a title for the vdim dimension/mode.
titlename:  row vector of class char or 1 element cell containing a name for the title.
class:  vector of class double (integer elements) and size(x.data,vdim) elements. Each element is a class identifier that can be used in plotting, classification, or cross-validation.
classname:  row vector of class char or 1 element cell containing a name for the class set.

2) For cases when the data set consists of multiple matrices of variable length (e.g.each data matrix has equal numbers 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 SET when the data field is of class cell (.type = 'batch'). For fields not listed below use the I/O syntax listed under subheading 1.

  • set(x,'field',value)

sets the property/field for a DataSet object to value. This syntax is used for the following fields:

type: value 'batch' set automatically when field is class cell
data: value is a cell array (extracts entire data set).

Example: g = dataset; %constructs a DataSet object set(g,'data',y) %where y is a N1 x 1 cell SET will check all the sizes of the contents of y to ensure that only the size of mode 1 varies from cell to cell and will also set the '.type' field to 'batch'.

  • set(x,'field',value,vdim,vset)

Set the field for a DataSet object to value for the specified dimension vdim and optional set vset {default: vset=1}, e.g. the vset input allows for multiple sets of labels to be used. The field '.data' must not be empty to set the values. 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 2 element vector with vdim(1)=1 and vdim(2)=i where i = 1, ..., N1. When vdim=1 then value is a cell array of length N1 and the contents of cell i is a vector of length N1,i. When vdim is a 2 element vector and vdim(2)=i then value is a vector of length N1,i. Example:

set(g,'axisscale',y2,1) %where y2 is a ''N1x1 ''cell array and the contents of each cell y2{i} (''i=1, ..., N1'') is a vector of length ''N1,I ''(''i.e. ''size(get(g,'data{i}'),1)) sets the mode 1 axis scale for all data arrays in '.data'.
set(x,'axisscale',[1:N13],[1 3])</tt> %where N13 = size(get(g,'data{3}'),1) sets the mode 1 axis scale for the 3rd data array (''i.e. ''contents of data{3}).
set(x,'axisscale',[1:N12],[1 2],2]) %where N12 = size(get(g,'data{2}'),1) sets the mode 1 axis scale for the 2nd data array (''i.e. ''contents of data{2}) for the second set.

See Also

dataset_get, dataset_subsasgn, dataset_subsref