How to get the XY of an imagesc rather than the rows and columns

4 ビュー (過去 30 日間)
Daniel Green
Daniel Green 2017 年 7 月 24 日
編集済み: Daniel Green 2017 年 8 月 9 日
I'm having trouble thinking of a way to retrieve the X and Y of my "imagesc" rather than the rows and columns. By using the code:
[value,location] = max(xyplane(:))
[R,C] = ind2sub(size(xyplane),location)
R and C return the rows and columns of the maximum I'm looking for. However, I want the X and Y, like I have displayed in the picture below.
I have used my own linspace to create my axes at this size.

採用された回答

Image Analyst
Image Analyst 2017 年 7 月 24 日
編集済み: Image Analyst 2017 年 7 月 24 日
Try this:
maxValue = max(xyplane(:))
[rows, columns] = find(xyplane == maxValue);
% If you'd rather them be named x and y:
[y, x] = find(xyplane == maxValue);

その他の回答 (1 件)

Pratik Anand
Pratik Anand 2017 年 7 月 24 日
You can check out ginput and datacursormode as both of them provide x,y coordintes.

カテゴリ

Help Center および File ExchangeVisual Exploration についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by