Dataset cat: Difference between revisions
imported>Jeremy (Importing text file) |
imported>Jeremy No edit summary |
||
Line 6: | Line 6: | ||
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 27: | ||
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 | |||
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_horzcat]], [[dataset_vertcat]] |
Revision as of 14:54, 8 October 2008
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
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