function intersect - set operationsthe function


Function intersect - set operations:

The function intersect returns, additionally to the vector having the values in the intersection of v1 and v2, an index vector into v1 and an index vector int v2 in such a way that outvec is similar as  v1(index1) and also v2(index2).

>> [outvec, index1, index2] = intersect(v1,v2)

outvec =

   3     5

index1 =

   2     4

index2 =

   2     3

By using such vectors to index into v1 and v2 will return the values from intersection. For illustration, such expression returns the second and fourth elements of v1:

>> v1(index1)

ans =

   3     5

This will return the second and third elements of v2:

>> v2(index2)

ans =

   3     5

 

Request for Solution File

Ask an Expert for Answer!!
Other Engineering: function intersect - set operationsthe function
Reference No:- TGS0175346

Expected delivery within 24 Hours