Dataset subsref: Difference between revisions
Jump to navigation
Jump to search
imported>Jeremy (Importing text file) |
imported>Jeremy No edit summary |
||
Line 2: | Line 2: | ||
Subindex for DataSet objects using Structure and index notation. | Subindex for DataSet objects using Structure and index notation. | ||
===Synopsis=== | ===Synopsis=== | ||
value = x.field{''vdim,vset''} | :value = x.field{''vdim,vset''} | ||
===Description=== | ===Description=== | ||
General overload for the subsref method. This method handles all generic indexing into a DataSet object. Below is a summary of the indexing it enables. | General overload for the subsref method. This method handles all generic indexing into a DataSet object. Below is a summary of the indexing it enables. | ||
value = x.field; | *'''<tt>value = x.field;</tt>''' | ||
returns the value (value) of the DataSet object field field. This syntax is used for the following fields: | returns the value (value) of the DataSet object field field. This syntax is used for the following fields: | ||
name: value is a char vector. | name: value is a char vector. | ||
Line 28: | Line 28: | ||
history: cell array of char (''e.g. ''char(x.history)) | history: cell array of char (''e.g. ''char(x.history)) | ||
datasetversion: DataSet object version. | datasetversion: DataSet object version. | ||
value = x.field{vdim}; | |||
*'''<tt>value = x.field{vdim};</tt>''' | |||
returns the value (value) for the field (field' for the specified dimension/mode ''vdim''. | returns the value (value) for the field (field' for the specified dimension/mode ''vdim''. | ||
include: value is row vector of indices for mode ''vdim'' | include: value is row vector of indices for mode ''vdim'' | ||
value = x.field{''vdim,vset''}; | |||
*'''<tt>value = x.field{''vdim,vset''};</tt>''' | |||
returns the value (value) for the field (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: | returns the value (value) for the field (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. | label: value is a char array with size(x.data,vdim) rows. | ||
Line 41: | Line 43: | ||
class: value is a row vector with size(x.data,vdim) integer elements. | class: value is a row vector with size(x.data,vdim) integer elements. | ||
classname: value is a char row vector. | classname: value is a char row vector. | ||
Examples | |||
===Examples=== | |||
<pre> | |||
plot(mydataset.axisscale{2}) %second dim axis scale | plot(mydataset.axisscale{2}) %second dim axis scale | ||
xlabel(mydataset.title{1,2}) %second title for first dim | xlabel(mydataset.title{1,2}) %second title for first dim | ||
disp(['Made by: ' mydataset.author]) | disp(['Made by: ' mydataset.author]) | ||
</pre> | |||
mydataset.class{2}(5) %give ''only'' the class for the ''fifth'' column (item 5 from dim 2) | All calls can be further indexed using standard Matlab notation. | ||
mydataset.class{2}(5) %give ''only'' the class for the ''fifth'' column (item 5 from dim 2) | |||
===See Also=== | ===See Also=== | ||
[[ | [[dataset_subsasgn]], [[dataset_get]], [[dataset_explode]] |
Revision as of 17:21, 8 October 2008
Purpose
Subindex for DataSet objects using Structure and index notation.
Synopsis
- value = x.field{vdim,vset}
Description
General overload for the subsref method. This method handles all generic indexing into a DataSet object. Below is a summary of the indexing it enables.
- value = x.field;
returns the value (value) of the DataSet object field 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,single, or [u]int8/16/32 array. imagemode: value is a scalar double. imagesize: value is a variable-length vector of double. label: value is the cell of all labels. labelname: value is the cell of all label names. axisscale: value is the cell of all axis scales. axisscalename: value is the cell of all axis scale names. title: value is the cell of all mode titles. titlename: value is the cell of all mode title names. class: value is the cell of all class identifiers. classname: value is the cell of all class identifier names. include: value is a cell with vectors for all included indices for all modes. userdata: user defined. description: value is a char array. history: cell array of char (e.g. char(x.history)) datasetversion: DataSet object version.
- value = x.field{vdim};
returns the value (value) for the field (field' for the specified dimension/mode vdim.
include: value is row vector of indices for mode vdim
- value = x.field{vdim,vset};
returns the value (value) for the field (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.
Examples
plot(mydataset.axisscale{2}) %second dim axis scale xlabel(mydataset.title{1,2}) %second title for first dim disp(['Made by: ' mydataset.author])
All calls can be further indexed using standard Matlab notation.
mydataset.class{2}(5) %give only the class for the fifth column (item 5 from dim 2)