matlab图上标坐标
时间: 2023-08-14 20:08:12 浏览: 110
在Matlab中,你可以使用以下代码在图上标注坐标:
```matlab
close all;
clear;
clc;
n = input('请输入点的数量 n = ');
pic = imread('20201106_161635.jpg');
I = imshow(pic);
loc_points = zeros(n,2);
for i = 1:1:n
hold on;
[x, y = my_ginput(1);
hold on;
plot(x, y, 'r.')
loc_points(i,1) = x;
loc_points(i,2) = y;
str = [' X:' num2str(x') ', Y:' num2str(y')];
text(x, y, cellstr(str))
end
```
这段代码会读取一张图片并选择特定的点数,然后记录下这些点的坐标信息。使用`my_ginput()`函数来获取鼠标点击位置,然后将点标记在图像上,并在每个点旁边显示其坐标。这样你就可以在Matlab图上标注坐标了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [matlab 中实现读取图像上点坐标并在图片上标记点和将坐标显示出来](https://blog.csdn.net/weixin_44769128/article/details/109670311)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* [matlab给xlabel/ylabel设置上标下标](https://blog.csdn.net/gls_nuaa/article/details/126845810)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文