Urgent: How to merge two datasets of different dimensions ??
9 views (last 30 days)
Show older comments
I have saved a dataset A of size 21000 observations and 10 variables and another dataset B with 900 observations and 2 variables.
Each observation of the dataset B is also contained in A but not the contrary!
I URGENTLY need to add to the dataset A a new last coloum (variable) which, in the observation which has the varaiable value identical to the same variable in B, has the value given by the value in the second variable in B. All values in the added coloumn which correspond to observations not present in B, remain blank.
I am very grateful for any help!! Silvia
0 Comments
Answers (2)
Walter Roberson
on 27 Mar 2011
It is not possible to have a blank column in a numeric dataset.
I cannot tell from your description which columns you are comparing between A and B.
You should probably look at ismember(), with with the 'rows' option if you are comparing both columns of B.
0 Comments
Matt Tearle
on 27 Mar 2011
Sounds like you want a left outer join
C = join(A,B,varname,'type','leftouter','mergekeys',true);
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!