constructing sequence of ismember
조회 수: 1 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
Walter Roberson
2012년 5월 23일
[tf, idx] = ismember(c, A);
B = lopp(idx(tf))
댓글 수: 9
Walter Roberson
2012년 5월 23일
There are repeats in c ? Hmmm, I'll have to think about this a bit more.
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!