Extracting data from a graph image using 'ginput'
5 次查看(过去 30 天)
显示 更早的评论
Hello,
I want to extract data using 'ginput' from an attached file.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/324469/image.jpeg)
采纳的回答
Vishal Gaur
2020-7-1
Hi Changho LEE,
Firstly, you have to digitize your graph. You can find many methods on File Exchange - https://www.mathworks.com/matlabcentral/fileexchange/?term=digitize&sort=ratings_desc
Then you can use ginput.
更多回答(1 个)
darova
2020-7-2
here is an example
x = rand(100,1); % generate some data
y = rand(100,1);
plot(x,y,'.r')
p = ginput(1);
d = pdist2([x y],p); % find combination of distances
[~,ix] = min(d); % index of closest poont
line(x(ix),y(ix),'linestyle','none','marker','o')
text(x(ix), y(ix),sprintf('%0.1f %0.1f',x(ix), y(ix)))
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!