|
|
Re: Removing vector elements that exist in another vector
Posted:
Nov 19, 2012 11:34 PM
|
|
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))=[]
|
|