Matchrows: Difference between revisions
Jump to navigation
Jump to search
imported>Scott (New page: ===Purpose=== Matches up rows from two DataSet objects using labels or sizes. ===Synopsis=== :[x,y] = matchrows(x,y) ===Description=== Given two input DataSet objects (x) and (y), MAT...) |
imported>Jeremy No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 12: | Line 12: | ||
(y) which match rows of (x) based on the labels in both objects and | (y) which match rows of (x) based on the labels in both objects and | ||
re-orders (y) to match (x). If (y) contains additional rows which match | re-orders (y) to match (x). If (y) contains additional rows which match | ||
no rows of (x), they are dropped | no rows of (x), they are dropped from (y). If some rows of (x) do not | ||
of (x) do not have matching (y) rows, the | have matching (y) rows, the corresponding rows of (y) are filled in with | ||
NaN. | |||
If no matching row labels are found, MATCHROWS searches other modes | If no matching row labels are found, MATCHROWS searches other modes | ||
of x and y for matching labels. If no matching labels are found in any | of x and y for matching labels. If no matching labels are found in any | ||
mode, sizes of the inputs are used to attempt a match. | mode, sizes of the inputs are used to attempt a match. If no sizes match, | ||
an error is thrown. | |||
The order of tests is: | The order of tests is: | ||
Line 26: | Line 29: | ||
* Number of y columns vs. number of x rows (transpose y) | * Number of y columns vs. number of x rows (transpose y) | ||
* Number of y columns vs. number of x columns (transpose x and y) (where k is the number of modes of x or y) Multi-dimensional x and y are supported by all tests. | * Number of y columns vs. number of x columns (transpose x and y) (where k is the number of modes of x or y) Multi-dimensional x and y are supported by all tests. | ||
====Outputs==== | ====Outputs==== | ||
Output DSOs are aligned (and possibly transposed) input DataSets. | Output DSOs are aligned (and possibly transposed) input DataSets. | ||
[[alignmat]], [[ | [[alignmat]], [[editds]], [[matchvars]], [[shuffle]] |
Latest revision as of 13:40, 9 June 2011
Purpose
Matches up rows from two DataSet objects using labels or sizes.
Synopsis
- [x,y] = matchrows(x,y)
Description
Given two input DataSet objects (x) and (y), MATCHROWS locates rows of (y) which match rows of (x) based on the labels in both objects and re-orders (y) to match (x). If (y) contains additional rows which match no rows of (x), they are dropped from (y). If some rows of (x) do not have matching (y) rows, the corresponding rows of (y) are filled in with NaN.
If no matching row labels are found, MATCHROWS searches other modes of x and y for matching labels. If no matching labels are found in any mode, sizes of the inputs are used to attempt a match. If no sizes match, an error is thrown.
The order of tests is:
- All label sets on mode 1 of both x and y
- All label sets on modes 2-k of y vs. mode 1 of x (transpose y)
- All label sets on modes 2-k of y vs. modes 2-k of x (transpose x and y)
- Number of y rows vs. number of x rows (no change)
- Number of y columns vs. number of x rows (transpose y)
- Number of y columns vs. number of x columns (transpose x and y) (where k is the number of modes of x or y) Multi-dimensional x and y are supported by all tests.
Outputs
Output DSOs are aligned (and possibly transposed) input DataSets.