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
hi um how do people design phones and stuff like da

can i get prportional and integral controller matlab coding to solve my load flow analysis

discuss the value of risk analysis and how the process can be used t derive project management decisions under conditions of uncertainty

Deadlock based problem in operating system# Deadlock usually occurs between a known set of processes that end up waiting on each other. If we cannot prevent or avoid deadlock, anot


Drawing operation can also be used for reducing the tube cross-section. The drawing equipment consists of draw bench and die. One end of the tube is pulled through the die over a f

Hi, do u help with HYSYS assignment ?

Explain derivatives in terms of capital markets The term mixture indicates that it has no separate value that is its value is entirely resulting from the of the actual resources


Q. Explain the following terms.             (i) Flash in forging.            (ii) Fullering and up setting in forging.            (iii) Trimming of