MATLAB Answers

0

comparing two separate for loops

Asked by Omar Almahallawy on 28 Apr 2019
Latest activity Answered by Image Analyst
on 28 Apr 2019
i have two seperate for loops
i need to compare them to display what is repeated ONLY in the both of them
ex.
Z =
0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002
Y =
0.0031 0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002
the asnwer should be
X=
0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002

  0 Comments

Sign in to comment.

1 Answer

Answer by Image Analyst
on 28 Apr 2019
 Accepted Answer

Use intersect():
Z =[0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002]
Y =[0.0031 0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002]
X = intersect(Z, Y)

  0 Comments

Sign in to comment.