Prev: What is the difference 2^-1024 and 1/(2^1024) in ieee- double
Next: Attempt to call constructor image with incorrect letter case
From: Wendy on 26 Jan 2010 06:22 Hi, I have two cells: A = {'212182_at' '210699_at' '201465_s_at' '206683_at' '201325_s_at' '203518_at'}; B = {'203518_at' '201325_s_at' '206683_at' '221558_s_at' '210184_at' '201566_x_at' '210699_at'}; How can I find the same elements between A and B? For example, '206683_at' occurs in both A and B. I want to output the position of '206683_at' in A. I know I can do this by looping through vector B, and do strcmp(B_i, A). Is there any function that can do the job better? Ideally, I am thinking if there is a function in matlab that compare two vectors at once. Thank you. Wendy
From: Jos (10584) on 26 Jan 2010 07:15 "Wendy " <wlq121(a)gmail.com> wrote in message <hjmj8r$lgb$1(a)fred.mathworks.com>... <SNIP looking for set functions ... help ismember help intersect Jos
From: us on 26 Jan 2010 07:15
"Wendy " <wlq121(a)gmail.com> wrote in message <hjmj8r$lgb$1(a)fred.mathworks.com>... > Hi, > > I have two cells: > A = {'212182_at' > '210699_at' > '201465_s_at' > '206683_at' > '201325_s_at' > '203518_at'}; > > B = {'203518_at' > '201325_s_at' > '206683_at' > '221558_s_at' > '210184_at' > '201566_x_at' > '210699_at'}; > > How can I find the same elements between A and B? For example, '206683_at' occurs in both A and B. I want to output the position of '206683_at' in A. I know I can do this by looping through vector B, and do strcmp(B_i, A). Is there any function that can do the job better? Ideally, I am thinking if there is a function in matlab that compare two vectors at once. > > Thank you. > Wendy a hint: help ismember; us |