Urgent: How to merge two datasets of different dimensions ??

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

回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 3 月 27 日

0 投票

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
Matt Tearle 2011 年 3 月 27 日

0 投票

Sounds like you want a left outer join
C = join(A,B,varname,'type','leftouter','mergekeys',true);

カテゴリ

ヘルプ センター および File ExchangeMatrices and Arrays についてさらに検索

質問済み:

2011 年 3 月 27 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by