Function ismember - set operations, Other Engineering

function ismember - set operations:

The function ismember receives two vectors as input arguments, and returns a logical vector which is of similar length as the first argument, having 1 for true when the element in the first vector is also in the second, or 0 for false when not.

The order of arguments matters for this function.

>> v1

v1 =

2 3 4 5 6

>> v2

v2 =

1 3 5 7

>> ismember(v1,v2)

ans =

0 1 0 1 0

>> ismember(v2,v1)

ans =

0 1 1 0

 

By using the answer from the ismember function as an index into the first vector argument will return similar result as the intersect function.

>> logv = ismember(v1,v2)

logv =

0 1 0 1 0

>> v1(logv)

ans =

   3         5

>> logv = ismember(v2,v1)

logv =

0 1 1 0

>> v2(logv)

ans =

   3     5

Posted Date: 10/22/2012 7:35:05 AM | Location : United States







Related Discussions:- Function ismember - set operations, Assignment Help, Ask Question on Function ismember - set operations, Get Answer, Expert's Help, Function ismember - set operations Discussions

Write discussion on Function ismember - set operations
Your posts are moderated
Related Questions
VARIATION OF ENERGY BAND GAP WITH ALLOY COMPOSITION

I want a project which is related to biotech engineering.. Something like designing or inventing .

The brayton cycle: The working cycle of the gas turbine engine is similar to that of the four-stroke piston engine.  There is induction, compression, ignition and exhaust in bo

find IDFT of the sequence X(k)={5,0,1,-j,0,1,0,1,j,0}

Objective of corporate financing Corporate finance control is a division of financial that refers to the control of money of an organization. The attention of corporate financi

Causes of unbalance Unbalance may be caused by a variety of factors occurring singly or in combination with others. These factors include:- a) Eccentricity Eccentricity

Your company is considering a machine that will cost $6,287 at Time 0 and which can be sold after 3 years for $790. To operate the machine, $886 must be invested at Time 0 in inven

Guidance Control system The control aspect of the guidance system is intended to stabilise the behaviour of the airframe.  The fact that the guidance system will always h

ENHANCEMENT MODE MOSFET In the enhancement-mode type, the gate must be forward biased to produce charge carriers in the channel. These devices are normally of and do not condu