comparing two separate for loops

3 visualizzazioni (ultimi 30 giorni)
Omar Almahallawy
Omar Almahallawy il 28 Apr 2019
Risposto: Image Analyst il 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

Risposta accettata

Image Analyst
Image Analyst il 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)

Più risposte (0)

Categorie

Scopri di più su Loops and Conditional Statements in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by