comparing two separate for loops

3 次查看(过去 30 天)
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

采纳的回答

Image Analyst
Image Analyst 2019-4-28
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 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by