Extracting y-data from ezplot.

Dear everyone
I've created a plot using ezplot, and I want to extract the ydata. Now I have used the get(object,'YData'), but all I get are the y-axis values. I'm doing the following:
cd=ezplot('1.5*x.^.56*y.^.44=1', [0 6 0 6]);
And then something like:
y=get(cd,'YData');
But all I get is values from 0 to 6, not the shown y-values in the figure! In essence I need all the (x,y)-pairs in the interval (0 excluded)
Thanks in advance Patrick

댓글 수: 1

kalpana
kalpana 2013년 8월 12일
I also want the x&y values of ezplot. how to get them? Please help us if you know.

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

 채택된 답변

Friedrich
Friedrich 2013년 8월 12일
편집: Friedrich 2013년 8월 12일

1 개 추천

Hi,
you need to get the contourMatrix:
bla = ezplot('1.5*x.^.56*y.^.44=1', [0 6 0 6]);
tmp = get(bla,'contourMatrix');
figure
plot(tmp(1,:),tmp(2,:))
set(gca,'ylim',[0 6])
Small note: Don't name a variable, e.g. "cd" like a MATLAB function.

댓글 수: 4

kalpana
kalpana 2013년 8월 12일
I don't know if i can comment on other's website. But, Thank you very much for your answer Friedrich.
Sorry Patrick for commenting on your web site.
Patrick
Patrick 2013년 8월 12일
It's totally okay kalpana!
Thank you so much Friedrich, solved my problem perfectly. Thank you also for the advice. I'm new at Matlab, so didn't think cd could be a ML-function (change directory I guess?).
Patrick
Patrick 2013년 8월 14일
By the way Friedrich, if you are still reading. If you don't mind me asking: how did you know this? I could not find the information in the 'help'-section myself, so I'm quite interrested in knowing where you got the information.
Thanks in advance, and again thank you for the answer itself.
Friedrich
Friedrich 2013년 8월 14일
편집: Friedrich 2013년 8월 14일
Hi,
I ran
bla = ezplot('1.5*x.^.56*y.^.44=1', [0 6 0 6]);
And then did a get(bla) to see what are the properties and what is stored in them. Since there aren't much properties which contain any numerical data it didn't took long to figure out that the data is stored under the contourMatrix property.

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

추가 답변 (0개)

카테고리

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

질문:

2013년 8월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by