comparing two separate for loops
1 view (last 30 days)
Show older comments
Omar Almahallawy
on 28 Apr 2019
Answered: 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
Accepted Answer
Image Analyst
on 28 Apr 2019
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
More Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!