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:
function to remove a array of numbers from a array?

Subject: function to remove a array of numbers from a array?

From: stinkinrich88

Date: 29 Aug, 2008 11:22:01

Message: 1 of 7

Hello, sorry for the long rubbish title

Say I had an array: a = [1 2 3 4 5 6]
and another: b = [2 4 6]

I want a function that will remove all of the values of b
from a. So I want a function that returns this:

function(a, b) = [1 3 5]

Is such a function built in to matlab already or do I need
to write one? Thanks!

Subject: function to remove a array of numbers from a array?

From: Bruno Luong

Date: 29 Aug, 2008 11:40:21

Message: 2 of 7

"stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
<g98m4p$s9u$1@fred.mathworks.com>...

>
> Is such a function built in to matlab already or do I need
> to write one? Thanks!

help setdiff

Bruno

Subject: function to remove a array of numbers from a array?

From: stinkinrich88

Date: 29 Aug, 2008 12:33:03

Message: 3 of 7

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in
message <g98n75$78s$1@fred.mathworks.com>...
> "stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
> <g98m4p$s9u$1@fred.mathworks.com>...
>
> >
> > Is such a function built in to matlab already or do I need
> > to write one? Thanks!
>
> help setdiff
>
> Bruno

Thank you, Bruno! That's exactly what I'm after!

Subject: function to remove a array of numbers from a array?

From: Steven Lord

Date: 29 Aug, 2008 14:56:38

Message: 4 of 7


"stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
news:g98m4p$s9u$1@fred.mathworks.com...
> Hello, sorry for the long rubbish title

Bruno already answered your question, but I wanted to comment on this
comment.

Having a descriptive title that's of a reasonable length (i.e. a sentence
rather than a single word or a novel) is a Good Thing. You clearly
indicated the problem you were trying to solve, which a title like "Urgent!"
or "Looking for a MATLAB function" does not. I encourage you to use "long
rubbish title"s whenever you post.

*snip*

--
Steve Lord
slord@mathworks.com

Subject: function to remove a array of numbers from a array?

From: stinkinrich88

Date: 29 Aug, 2008 15:06:02

Message: 5 of 7

"Steven Lord" <slord@mathworks.com> wrote in message
<g992n6$65g$1@fred.mathworks.com>...
>
> "stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
> news:g98m4p$s9u$1@fred.mathworks.com...
> > Hello, sorry for the long rubbish title
>
> Bruno already answered your question, but I wanted to
comment on this
> comment.
>
> Having a descriptive title that's of a reasonable length
(i.e. a sentence
> rather than a single word or a novel) is a Good Thing.
You clearly
> indicated the problem you were trying to solve, which a
title like "Urgent!"
> or "Looking for a MATLAB function" does not. I encourage
you to use "long
> rubbish title"s whenever you post.
>
> *snip*
>
> --
> Steve Lord
> slord@mathworks.com
>
>

Ahh, true! Thanks! I know what you mean about those useless
titles like "help".

p.s. I'm not sure if I have to mark this thread as solved...
I couldn't find a way to do it.

Subject: function to remove a array of numbers from a array?

From: Steven Lord

Date: 29 Aug, 2008 15:21:55

Message: 6 of 7


"stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
news:g9938q$c69$1@fred.mathworks.com...
> "Steven Lord" <slord@mathworks.com> wrote in message
> <g992n6$65g$1@fred.mathworks.com>...
>>
>> "stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
>> news:g98m4p$s9u$1@fred.mathworks.com...
>> > Hello, sorry for the long rubbish title
>>
>> Bruno already answered your question, but I wanted to
> comment on this
>> comment.
>>
>> Having a descriptive title that's of a reasonable length
> (i.e. a sentence
>> rather than a single word or a novel) is a Good Thing.
> You clearly
>> indicated the problem you were trying to solve, which a
> title like "Urgent!"
>> or "Looking for a MATLAB function" does not. I encourage
> you to use "long
>> rubbish title"s whenever you post.
>>
>> *snip*
>>
>> --
>> Steve Lord
>> slord@mathworks.com
>>
>>
>
> Ahh, true! Thanks! I know what you mean about those useless
> titles like "help".
>
> p.s. I'm not sure if I have to mark this thread as solved...
> I couldn't find a way to do it.

Just post something like "Thanks, that solved the problem." or "Thank you,
Bruno! That's exactly what I'm after!"

--
Steve Lord
slord@mathworks.com

Subject: function to remove a array of numbers from a array?

From: stinkinrich88

Date: 29 Aug, 2008 15:43:02

Message: 7 of 7

"Steven Lord" <slord@mathworks.com> wrote in message
<g9946j$mb6$1@fred.mathworks.com>...
>
> "stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
> news:g9938q$c69$1@fred.mathworks.com...
> > "Steven Lord" <slord@mathworks.com> wrote in message
> > <g992n6$65g$1@fred.mathworks.com>...
> >>
> >> "stinkinrich88 " <stinkinrich88@gmail.com> wrote in message
> >> news:g98m4p$s9u$1@fred.mathworks.com...
> >> > Hello, sorry for the long rubbish title
> >>
> >> Bruno already answered your question, but I wanted to
> > comment on this
> >> comment.
> >>
> >> Having a descriptive title that's of a reasonable length
> > (i.e. a sentence
> >> rather than a single word or a novel) is a Good Thing.
> > You clearly
> >> indicated the problem you were trying to solve, which a
> > title like "Urgent!"
> >> or "Looking for a MATLAB function" does not. I encourage
> > you to use "long
> >> rubbish title"s whenever you post.
> >>
> >> *snip*
> >>
> >> --
> >> Steve Lord
> >> slord@mathworks.com
> >>
> >>
> >
> > Ahh, true! Thanks! I know what you mean about those useless
> > titles like "help".
> >
> > p.s. I'm not sure if I have to mark this thread as solved...
> > I couldn't find a way to do it.
>
> Just post something like "Thanks, that solved the
problem." or "Thank you,
> Bruno! That's exactly what I'm after!"
>
> --
> Steve Lord
> slord@mathworks.com
>
>

Ahh, that's easy! Thanks Steven! And thanks for everyone's
help.

Tags for 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