constructing sequence of ismember

1 次查看(过去 30 天)
antonet
antonet 2012-5-23
Hi all,
I have the vector A=
l1
‘l2’
‘Kl9’
‘E9’
In my case, A contains hundreds of different elements (‘l1’,‘l2’,…). I want to produce a series of
lopp(ismember(c,{'x' })) where x stands for each element of A So I want to have
B=[ lopp(ismember(c,{'l1' })) lopp(ismember(c,{'l2' })) lopp(ismember(c,{'KI9' })) lopp(ismember(c),{'E9' }))…]
Is there any code that will enable me to construct B automatically
thanks

回答(1 个)

Walter Roberson
Walter Roberson 2012-5-23
[tf, idx] = ismember(c, A);
B = lopp(idx(tf))
  9 个评论
Walter Roberson
Walter Roberson 2012-5-23
There are repeats in c ? Hmmm, I'll have to think about this a bit more.
antonet
antonet 2012-5-24
yes i have repeated l1s l2s l3s l4s and l5s in c. thank you again

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Logical 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by