Hello, greetings to all. I was wondering if anyone would know if there is a function that receiving a data set like this small example:
X = [2 4 8];
Y= [2 2 4];
Could convert Y-axis data to become:
X = [2 4 8];
Y= [4 4 2];
This example is very simple but the real one has much more points, it is not something as simple as assigning the minimum to the maximum and vice versa. Thank you in advance.

댓글 수: 4

Alejandro Fernández
Alejandro Fernández 2021년 1월 27일
I have a method to solve this problem but it is very crude
Jan
Jan 2021년 1월 27일
Please mention, how [2 2 4] and [4 4 2] are related. The readers cannot guess this detail. The explanation, that "it is not simple", is not unique.
@Jan Another way to explain it would be to try to obtain the values of the Y-axis based on the ordinary axes X,Y when the representation of these axes is made using:
figure;
scatter(X,Y,'filled');
set(gca,'YDir','reverse');
Adam Danz
Adam Danz 2021년 3월 12일
If I understand correctly, you want to know what the y-coordinates would be if the y axis were flipped but the datapoints stayed in their original positions within the axes. That raises a red flag to me. If you could explain why you want to do this or how you plan to use the data, perhaps we could suggesting something more eifficient and sound. The problem is, y axis limits could change so it's not just a matter of flipping the data vertically around some reflection point.

댓글을 달려면 로그인하십시오.

답변 (1개)

Veronica Taurino
Veronica Taurino 2021년 3월 12일
편집: Veronica Taurino 2021년 3월 12일

1 개 추천

I don't get the question as well.
What result do you expect on the following arrays:
X = [2 4 8 4 2 56 78];
Y= [2 2 4 11 75 12 5];
You need to explain how variables are related.

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

릴리스

R2020b

질문:

2021년 1월 27일

댓글:

2021년 3월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by