ismember() returning without unique indexing

I want to get a result from ismember function such that
a =[{'aa'};{'bb'};{'cc'};{'dd'};{'ee'}];
b = [{'bb'};{'bb'};{'dd'};{'dd'};{'dd'};{'dd'}];
idx = find(ismember(a,b) == 1);
then idx = [2 4];
however, I want to get the results like idx = [2 2 4 4 4 4];
so, the frequency of cell array in b is conserved.
Would please somebody help me?
Thanks.
justin

 採用された回答

Oleg Komarov
Oleg Komarov 2011 年 5 月 18 日

2 投票

[tf,loc] = ismember(b,a);
loc.' =
2 2 4 4 4 4

1 件のコメント

Jan
Jan 2011 年 5 月 18 日
@JC: You find this behaviour explained in the help text. It is worth to read.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

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

質問済み:

JC
2011 年 5 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by