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
Plotting File data: It is frequently essential to read data from a file and plot it. Generally, this entails knowing the format of the file. For illustration, let us suppose t

Initializing the data structure - Function: Function is shown as:   >> printcylvols(cyls) Cylinder x has a volume of 169.6 Cylinder a has a volume of 100.5

Patch function - graphics objects: The patch function is used to generate a patch graphics object, which is made from 2-dimensional polygons. The patch is defined by its verti

Referring to and Showing Cell Array Elements and Attributes: Just as with the other vectors, we can refer to individual elements of the cell arrays. The only difference is tha

Scaling:   change a row by multiplying it by a non-zero scalar sri →  ri For illustration, for the matrix:

Function used in sound files: The MATLAB has numerous other functions which let you read and play sound or audio files. In the audio files, sampled data for each audio channel

Function cellplot - Cell array: The function cellplot place a graphical display of the cell array in a figure Window; though, it is a high-level view and fundamentally just di

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

Displaying expressions: The good-looking function will show such expressions by using exponents; for illustration, >> b = sym('x^2') b = x^2 >> pretty(b)

Use of While loop: Here is an illustration of calling the function, passing 5000 for the value of the input argument high. >> factgthigh(5000) ans = 5040 The itera