Axis x,y value to pixcel ?!
1 次查看(过去 30 天)
显示 更早的评论
I have 3 matrix lat/long and c as my other parameter. I need to find the c value for a given lat/long. Since lat/long are a matrix of 1200 pixels, I need to plot them and then use a line function to find the desired position on the image, my code is shown below. Instead of using [x y]= ginput (1), which requires a pointer, I use my line result to find the position of the point on the axes. But I can't use the impixelinfo function, and axes2pix doesn't work for me either. So is there any way to just extract the c value for a point on the plot based on the axis coordinate!!!! Or convert the axis coordinates to pixcel values and from there find the c value from the matrix?!!!
m_pcolor(S.lon, S.lat, S.im) % lat = S.lat; lon = S.lon; c = S.im;
t= m_line(-35.852379,-74.960411,'marker','o','markerfacecolor','r','linewidth',0.5,'MarkerEdgeColor','r', 'linest','none','MarkerSize',8);%, 'MarkerEdgeColor','k'
x = -0.1546; y = 0.2140 % XData: -0.1546 ; YData: 0.2140 % how to convert to pixcel value?!
[filonx,filaty] = m_xy2ll(x,y) %filonx = -35.8455 ; filaty = -74.9607
% but C??
% % % for extra over view
% t =
% Line (m_line) with properties:
%
% Color: [0 0.4470 0.7410]
% LineStyle: 'none'
% LineWidth: 0.5000
% Marker: 'o'
% MarkerSize: 8
% MarkerFaceColor: [1 0 0]
% XData: -0.1546
% YData: 0.2140
% ZData: [1×0 double]
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/579932/image.png)
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Visual Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!