필터 지우기
필터 지우기

intersect 2 arrays problem

조회 수: 4 (최근 30일)
Josefina Ottitsch
Josefina Ottitsch 2019년 3월 2일
댓글: Josefina Ottitsch 2019년 3월 2일
Hello,
if
x=[2.34;3.45;3.21;4.56]
and
y=[3.2;3.67;3.7;5.23]
and
z=[3.3;3.5;4]
how do I get matlab to tell me
xyz=[3.21;3.2;3.3;3.45;3.5;3.67;3.7;4;4.56]
?
So in other words I want matlab to tell me for xy all the numbers between the minimum of y and the maximum of x.
intersect didnt work because the numbers are not the same...
Thank you so much for the support!

채택된 답변

Walter Roberson
Walter Roberson 2019년 3월 2일
xyz = union(union(x,y),z);
xyz(xyz < min(y) | xyz > max(x)) = [];

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by