Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: How to extract data points from a plot (can't use 'ginput')
Replies: 6   Last Post: Jan 31, 2013 5:26 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Walter Roberson

Posts: 7,673
Registered: 1/20/06
Re: How to extract data points from a plot (can't use 'ginput')
Posted: Aug 25, 2008 12:05 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Forrest wrote:

> I'm not very familiar with 'findobj'. Can you walk me
> through how to do this.


lines = findobj(gcf, 'Type', 'line');
nlines = length(lines);
coordscell = cell(nlines,2);
for K=1:nlines
thisline = lines(K);
coordscell{K,1} = get(thisline, 'XData');
coordscell{K,2} = get(thisline, 'YData');
end

If you are lucky, afterwards coordscell will only have 1 x 2 entries,
a single X and Y pair. If not, then you will have to figure out -which-
of the lines is the relevant one for your purposes. *Usually* lines
that Matlab draws for background purposes (e.g., grid lines) will be
hidden objects, but not always.

I can't show you the process from start to finish or test this in
advance as psd() does not take simple waveforms and produce a plot;
it takes a spectrum object class as input and returns something
in a different class that has to be plotted by some other function
(but I couldn't immediately see what the actual plot routine was.)

--
Q = quotation(rand);
if isempty(Q); error('Quotation server filesystem problems')
else sprintf('%s',Q), end



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.