MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > check if vector is subset of another 

Subject: check if vector is subset of another From: Pr B Date: 6 May, 2011 00:48:05 Message: 1 of 10 
i have vectors of doubles a = [1 2 3], b = [1 2 3 4], c = [1 3 2 4]. i want to check if one vector is the perfect subset of another while preserving order. e.g. i would like to see that a is a perfect subset of b but not a subset of c. i'm trying to use ismember to do this, but the output is just a sequence of [1 1 1] when i do isequal(a,a(ismember(a,b))). any suggestions? 
On 5/5/2011 7:48 PM, Pr B wrote: 
Subject: check if vector is subset of another From: Darren Rowland Date: 6 May, 2011 00:59:07 Message: 3 of 10 

Subject: check if vector is subset of another From: Nasser M. Abbasi Date: 6 May, 2011 01:44:25 Message: 4 of 10 
On 5/5/2011 5:48 PM, Pr B wrote: 
Subject: check if vector is subset of another From: Nasser M. Abbasi Date: 6 May, 2011 01:56:09 Message: 5 of 10 

Subject: check if vector is subset of another From: Roger Stafford Date: 6 May, 2011 02:22:04 Message: 6 of 10 
"Pr B" <pb2297@columbia.edu> wrote in message <ipvgg4$dur$1@newscl01ah.mathworks.com>... 
Subject: check if vector is subset of another From: Nasser M. Abbasi Date: 6 May, 2011 02:32:08 Message: 7 of 10 
On 5/5/2011 7:22 PM, Roger Stafford wrote: 
Subject: check if vector is subset of another From: Pr B Date: 6 May, 2011 02:37:04 Message: 8 of 10 
funny, i didn't anticipate this to be that tough of a problem. thanks for everyone's input thus far. 
Subject: check if vector is subset of another From: Nasser M. Abbasi Date: 6 May, 2011 02:41:16 Message: 9 of 10 
On 5/5/2011 7:37 PM, Pr B wrote: 
Subject: check if vector is subset of another From: Pr B Date: 6 May, 2011 02:48:04 Message: 10 of 10 
now in actuality, i want to test all possible pairs of [a b c d] to see if any of them are subsets of each other...what part of this code do i modify? 
No tags are associated with this thread.
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.