The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Removing vector elements that exist in another vector
Replies: 5   Last Post: Nov 27, 2012 1:47 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2
Registered: 11/19/12
Re: Removing vector elements that exist in another vector
Posted: Nov 19, 2012 11:37 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

You are a saint! Thank you!!

"Nasser M. Abbasi" <> wrote in message <k8f17v$brn$>...
> On 11/19/2012 10:29 PM, Adam wrote:
> > I have a vector like this:
> > A= [107,108,109,110,111,112,113,114,207,208,209,210,211,212,213,214,307,308,309,
> >310,311,312,313,314,407,408,409,410,411,412,413,414];
> > And I want to remove these elements from A:
> > H1 = 313 314 114 207 312 214
> >
> > As H1 changes frequently in the program that I'm writing, I want to use the
> >variable H1 for the removal of said elements. Is there any way I could somehow do this?
> >When I try methods I've found online, matlab attempts to remove the 313th element of
> >A, which obviously results in an error message.
> >
> > Any help is greatly appreciated!
> >

> A(ismember(A,H1))=[]

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.