Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
string problem

Subject: string problem

From: Wendy

Date: 15 Mar, 2010 22:23:06

Message: 1 of 3

Hi all,

I have two list of strings,

A = {'PREPL', 'KRT5', 'CAD', 'CD163', 'FHL1'}

B = {'FAM172A', 'PEF1','PREPL', 'KRT5', 'RAN'}

'PREPL' and 'KRT5' are overlapped in both A and B. I want to output the unique gene in A, i.e., 'CAD','CD163','FHL1'. I know I can compare every single string in A to B list using 'strncmp', but it takes too long as my lists are consisted of 2000 strings. I was wondering if there is function that I can compare two lists and output the unique strings in A in one step.

Thank you,
Wendy

Subject: string problem

From: Nathan

Date: 15 Mar, 2010 22:24:57

Message: 2 of 3

On Mar 15, 3:23 pm, "Wendy " <wlq...@gmail.com> wrote:
> Hi all,
>
> I have two list of strings,
>
> A = {'PREPL', 'KRT5', 'CAD', 'CD163', 'FHL1'}
>
> B = {'FAM172A', 'PEF1','PREPL', 'KRT5', 'RAN'}
>
> 'PREPL' and 'KRT5' are overlapped in both A and B. I want to output the unique gene in A, i.e., 'CAD','CD163','FHL1'. I know I can compare every single string in A to B list using 'strncmp', but it takes too long as my lists are consisted of 2000 strings. I was wondering if there is function that I can compare two lists and output the unique strings in A in one step.
>
> Thank you,
> Wendy

doc setdiff

Example:

setdiff(A,B)
%%%%%%%%%%%%%%%%%%
ans =
    'CAD' 'CD163' 'FHL1'


-Nathan

Subject: string problem

From: Wendy

Date: 15 Mar, 2010 22:35:25

Message: 3 of 3

Thank you so much Nathan. This saves me a lot.
Wendy
Nathan <ngreco32@gmail.com> wrote in message <474eb360-5e40-4639-ad7c-e793f54392e8@w39g2000prd.googlegroups.com>...
> On Mar 15, 3:23 pm, "Wendy " <wlq...@gmail.com> wrote:
> > Hi all,
> >
> > I have two list of strings,
> >
> > A = {'PREPL', 'KRT5', 'CAD', 'CD163', 'FHL1'}
> >
> > B = {'FAM172A', 'PEF1','PREPL', 'KRT5', 'RAN'}
> >
> > 'PREPL' and 'KRT5' are overlapped in both A and B. I want to output the unique gene in A, i.e., 'CAD','CD163','FHL1'. I know I can compare every single string in A to B list using 'strncmp', but it takes too long as my lists are consisted of 2000 strings. I was wondering if there is function that I can compare two lists and output the unique strings in A in one step.
> >
> > Thank you,
> > Wendy
>
> doc setdiff
>
> Example:
>
> setdiff(A,B)
> %%%%%%%%%%%%%%%%%%
> ans =
> 'CAD' 'CD163' 'FHL1'
>
>
> -Nathan

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us