Urgent: How to merge two datasets of different dimensions ??
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
Answers (2)
Walter Roberson
on 27 Mar 2011
0 votes
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.
Matt Tearle
on 27 Mar 2011
Sounds like you want a left outer join
C = join(A,B,varname,'type','leftouter','mergekeys',true);
Categories
Find more on Managing Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!