Intersect function and setdiff function, MATLAB in Engineering

Intersect function and setdiff function:

The intersect function rather than returns all the values which can be found in both of the input argument vectors.

>> intersect(v1,v2)

ans =

    3   5

The setdiff function receives two vectors as input arguments, and returns a vector having all the values which are contained in the first vector argument but not in the second. And hence, the order of the two input arguments is very important.

>> setdiff(v1,v2)

ans =

2 4 6

>> setdiff(v2,v1)

ans =

    1   7

Posted Date: 10/22/2012 7:32:17 AM | Location : United States







Related Discussions:- Intersect function and setdiff function, Assignment Help, Ask Question on Intersect function and setdiff function, Get Answer, Expert's Help, Intersect function and setdiff function Discussions

Write discussion on Intersect function and setdiff function
Your posts are moderated
Related Questions
IS Functions for Strings: There are many functions for strings, that return logical true or false. The function isletter returns the logical true when the character is a lette

Structures: The Structures are data structures which group together values which are logically related in what are known as the fields of structure. The benefit of structures

Replacing a string - function strrep: The function strrep finds all the occurrences of a substring within the string, and substitutes them with a new substring. The order of a

Example of modular program: In a modular program, there would be one main script which calls three separate functions to complete these tasks: A function to prompt an us

How can I use the weighted moving average formula in matlab to smooth a column data of 404 values?

Plotting from a Function: The following function creates a Figure Window as shown in figure, which shows various types of plots for similar y vector. The vector is passed as a

Illustration of if - else statement: The one application of an if-else statement is to check for errors in the inputs to a script. For illustration, a former script prompted t

Dot Product: The dot or inner product of two vectors a and b is written as a • b and is defined as  In another words, this is like matrix multiplication when multiplyi

Polyhedron - graphics objects: The field polyhedron.vertices is a matrix in which each row presents (x,y,z) points. The field polyhedron.faces defines the faces: for illustrat

Logical scalar values: The MATLAB also has or and and operators which work element wise for the matrices: These operators will compare any of the two vectors or matric