Dataset cat: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Scott No edit summary |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
Generic concatenation of DataSet objects. | Generic concatenation of DataSet objects. | ||
===Synopsis=== | ===Synopsis=== | ||
z = cat(dim,a, b, c, ... ); | :z = cat(dim,a, b, c, ... ); | ||
===Description=== | ===Description=== | ||
Generic concatenation implies combination of DataSet objects along some specified dimension, dim. Any number of DataSet objects can be concatenated. When dim is 1 or 2, this command is equivalent to [a; b; ...] or [a b ...], respectively (see dataset/vertcat and dataset/horzcat). | Generic concatenation implies combination of DataSet objects along some specified dimension, dim. Any number of DataSet objects can be concatenated. When dim is 1 or 2, this command is equivalent to [a; b; ...] or [a b ...], respectively (see dataset/vertcat and dataset/horzcat). | ||
For this operation to be defined the following must be true: | For this operation to be defined the following must be true: | ||
1) All inputs must be valid DataSet objects or convertible to a DataSet object. | 1) All inputs must be valid DataSet objects or convertible to a DataSet object. | ||
2) The DataSet '.type' fields must all be the same. | 2) The DataSet '.type' fields must all be the same. | ||
3) Concatenation is along the specified dimension (dim). All other dimension sizes must match. | 3) Concatenation is along the specified dimension (dim). All other dimension sizes must match. | ||
This is similar to matrix concatenation, but each field is treated differently. In structure notation this is: | This is similar to matrix concatenation, but each field is treated differently. In structure notation this is: | ||
z.name = name fields from all DataSet objects are concatenated. | z.name = name fields from all DataSet objects are concatenated. | ||
z.type = a.type; | z.type = a.type; | ||
Line 22: | Line 28: | ||
z.description = concatenates all descriptions | z.description = concatenates all descriptions | ||
z.userdata = if more than one input has userdata it is filled into a cell array, if only one input has userdata it is returned, else it is empty | z.userdata = if more than one input has userdata it is filled into a cell array, if only one input has userdata it is returned, else it is empty | ||
Example | NOTE: Concatenating classes can be complicated when class name and values don't match. Merging classes is done by the private tablemerge function of the DataSetObject. The first DataSet being concatenated takes precedence if a numeric class has two different names. If there is a duplicated name (with two different numeric classes then "DuplicatedName" is appended to the second DataSet lookup table name. | ||
z = cat(3,a,b); %join a and b in the third dimension | |||
===Example=== | |||
The following concatenates two DataSet objects, a and b, along the third dimension (slabs): | |||
z = cat(3,a,b); %join a and b in the third dimension | |||
===See Also=== | ===See Also=== | ||
[[dataset]], [[datasetdemo]], [[ | [[dataset]], [[datasetdemo]], [[dataset_augment]], [[dataset_horzcat]], [[dataset_vertcat]] |
Latest revision as of 10:39, 27 March 2019
Purpose
Generic concatenation of DataSet objects.
Synopsis
- z = cat(dim,a, b, c, ... );
Description
Generic concatenation implies combination of DataSet objects along some specified dimension, dim. Any number of DataSet objects can be concatenated. When dim is 1 or 2, this command is equivalent to [a; b; ...] or [a b ...], respectively (see dataset/vertcat and dataset/horzcat). For this operation to be defined the following must be true:
1) All inputs must be valid DataSet objects or convertible to a DataSet object.
2) The DataSet '.type' fields must all be the same.
3) Concatenation is along the specified dimension (dim). All other dimension sizes must match.
This is similar to matrix concatenation, but each field is treated differently. In structure notation this is:
z.name = name fields from all DataSet objects are concatenated. z.type = a.type; z.author = author fields from all DataSet objects are concatenated. z.date = date of concatenation z.moddate = date of concatenation z.data = cat(dim,a.data,b.data,c.data); z.label = mode dim label sets are concatenated, and new label sets are created for all other modes z.axisscale = mode dim axisscale sets are made empty, and new axisscale sets are created for all other modes z.title = new label sets are created z.class = mode dim class sets are made empty, and new class sets are created for all other modes z.description = concatenates all descriptions z.userdata = if more than one input has userdata it is filled into a cell array, if only one input has userdata it is returned, else it is empty
NOTE: Concatenating classes can be complicated when class name and values don't match. Merging classes is done by the private tablemerge function of the DataSetObject. The first DataSet being concatenated takes precedence if a numeric class has two different names. If there is a duplicated name (with two different numeric classes then "DuplicatedName" is appended to the second DataSet lookup table name.
Example
The following concatenates two DataSet objects, a and b, along the third dimension (slabs):
z = cat(3,a,b); %join a and b in the third dimension
See Also
dataset, datasetdemo, dataset_augment, dataset_horzcat, dataset_vertcat