sorting the values of a vector into a new one by its elements size
조회 수: 1 (최근 30일)
이전 댓글 표시
Hey all
I made some measurements. Between these values, I interpolated. Now, I want to merge both vectors into one but withouth changing the order. Just copy in the new interpolated values into the intervalls of the measured values.
Is there a predefined function from matlab or do I have to write it myself?
Thanks in advance
댓글 수: 2
채택된 답변
Luna
2018년 11월 29일
Try this,
xnew = sort(horzcat(y,x)) % concatane vectors then sort all
%% OR
xnew = horzcat(sort(y),sort(x)) % sort x, sort y seperately then concatanate
댓글 수: 3
추가 답변 (1개)
madhan ravi
2018년 11월 29일
편집: madhan ravi
2018년 11월 29일
Simple and easy solution:
xnew=sort([x y])
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!