Dataset delsamps: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Jeremy |
||
(4 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Deletes or excludes the specified samples, rows, or other dimension from a DataSet object. | Deletes or excludes the specified samples, rows, or other dimension from a DataSet object. | ||
===Synopsis=== | ===Synopsis=== | ||
eddata = delsamps(data,inds,vdim,flag) | :eddata = delsamps(data,inds,vdim,flag) | ||
===Description=== | ===Description=== | ||
DELSAMPS modifies the include field of a DataSet to mark rows or columns to be "excluded" keeping the data in the DataSet (i.e. soft delete). It can also be used to permanently remove rows or columns from a DataSet object (i.e. hard delete). | DELSAMPS modifies the include field of a DataSet to mark rows or columns to be "excluded" keeping the data in the DataSet (i.e. soft delete). It can also be used to permanently remove rows or columns from a DataSet object (i.e. hard delete). | ||
Inputs are the original DataSet object, data, and the indices to mark, inds. Optional input vdim is the mode/dimension to mark | Inputs are the original DataSet object, data, and the indices to mark, inds. Optional input vdim is the mode/dimension to mark | ||
:1=rows {default}, and | |||
:2=columns, etc. | |||
Optional input (flag) indicates to mark/soft delete when set to 1 {default}, hard delete when set to 2, or hard "keep" when set to 3. The output is the edited DataSet object (eddata). | Optional input (flag) indicates to mark/soft delete when set to 1 {default}, hard delete when set to 2, or hard "keep" when set to 3. The output is the edited DataSet object (eddata). | ||
Examples | |||
===Examples=== | |||
The first example returns a DataSet object with the first two rows (samples) excluded (soft delete), the second hard-deletes the first two columns: | The first example returns a DataSet object with the first two rows (samples) excluded (soft delete), the second hard-deletes the first two columns: | ||
a = delsamps(a,[1 2]); %soft delete rows 1 and 2 | a = delsamps(a,[1 2]); %soft delete rows 1 and 2 | ||
a = delsamps(a,[1 2],2,2); %hard delete columns 1 and 2 | a = delsamps(a,[1 2],2,2); %hard delete columns 1 and 2 | ||
When flag = 3, the function of inds is inverted and indicates the indices to ''keep'' (all others are deleted). The order the indices appear in inds specifies the new order of the rows/columns/etc. in the result. Thus, the delsamps command | When flag = 3, the function of inds is inverted and indicates the indices to ''keep'' (all others are deleted). The order the indices appear in inds specifies the new order of the rows/columns/etc. in the result. Thus, the delsamps command | ||
eddata = delsamps(data,inds,2,3); | eddata = delsamps(data,inds,2,3); | ||
is equivalent to performing the operation (see dataset/subsref): | |||
eddata = data(:,inds); | eddata = data(:,inds); | ||
===See Also=== | ===See Also=== | ||
[[datasetdemo]], [[ | [[datasetdemo]], [[dataset_subsref]] |
Latest revision as of 15:12, 8 October 2008
Purpose
Deletes or excludes the specified samples, rows, or other dimension from a DataSet object.
Synopsis
- eddata = delsamps(data,inds,vdim,flag)
Description
DELSAMPS modifies the include field of a DataSet to mark rows or columns to be "excluded" keeping the data in the DataSet (i.e. soft delete). It can also be used to permanently remove rows or columns from a DataSet object (i.e. hard delete). Inputs are the original DataSet object, data, and the indices to mark, inds. Optional input vdim is the mode/dimension to mark
- 1=rows {default}, and
- 2=columns, etc.
Optional input (flag) indicates to mark/soft delete when set to 1 {default}, hard delete when set to 2, or hard "keep" when set to 3. The output is the edited DataSet object (eddata).
Examples
The first example returns a DataSet object with the first two rows (samples) excluded (soft delete), the second hard-deletes the first two columns:
a = delsamps(a,[1 2]); %soft delete rows 1 and 2 a = delsamps(a,[1 2],2,2); %hard delete columns 1 and 2
When flag = 3, the function of inds is inverted and indicates the indices to keep (all others are deleted). The order the indices appear in inds specifies the new order of the rows/columns/etc. in the result. Thus, the delsamps command
eddata = delsamps(data,inds,2,3);
is equivalent to performing the operation (see dataset/subsref):
eddata = data(:,inds);