From: Wendy on
Hi all,

I have a list of names, for instance

A = {'PRE_BCELL2.3'
'BCELLA1.2.3.4'
'BASO1'
'MEGA1.2'
'BCELLA1.2.3.4'
'NKA1'
'GMP.GRAN1.2.3'
'NKA2.3.TCELL'
'MONO1.2'
'MONO1.2'};

I also have a reference numbers of these names as following

1 HSC1.3
2 MEP.ERY1.2
3 MEGA1.2
4 GMP.GRAN1.2.3
5 MONO1.2
6 BASO1
7 PRE_BCELL2.3
8 BCELLA1.2.3.4
9 NKA1
10 NKA2.3.TCELL
11 DENDA1.2

I want to find the reference numbers of each name in my vector A at once. Right now, I am using strmatch the name in the reference list to strarray A one by one. As my list of strarray is long, I wonder if there is a way that I can find all the reference numbers of all the elements in the strarray A at once.

Thank you in advance,
Wendy
From: us on
"Wendy " <wlq121(a)gmail.com> wrote in message <i2k7ro$dom$1(a)fred.mathworks.com>...
> Hi all,
>
> I have a list of names, for instance
>
> A = {'PRE_BCELL2.3'
> 'BCELLA1.2.3.4'
> 'BASO1'
> 'MEGA1.2'
> 'BCELLA1.2.3.4'
> 'NKA1'
> 'GMP.GRAN1.2.3'
> 'NKA2.3.TCELL'
> 'MONO1.2'
> 'MONO1.2'};
>
> I also have a reference numbers of these names as following
>
> 1 HSC1.3
> 2 MEP.ERY1.2
> 3 MEGA1.2
> 4 GMP.GRAN1.2.3
> 5 MONO1.2
> 6 BASO1
> 7 PRE_BCELL2.3
> 8 BCELLA1.2.3.4
> 9 NKA1
> 10 NKA2.3.TCELL
> 11 DENDA1.2
>
> I want to find the reference numbers of each name in my vector A at once. Right now, I am using strmatch the name in the reference list to strarray A one by one. As my list of strarray is long, I wonder if there is a way that I can find all the reference numbers of all the elements in the strarray A at once.
>
> Thank you in advance,
> Wendy

a hint:

help ismember;

us