How to display x and y axis to an image in app designer
21 次查看(过去 30 天)
显示 更早的评论
Hi I attempted to add x and y axis to the image in app designer as I did in GUIDE, I decided to give up and ask for help here.
Here below are my codes:
[filname,pathname] = uigetfile('*.tif', 'Select File to work with');
app.FileNameEditField.Value=filname;
img_ori = imread([pathname, '\', filname]);
[row_img,col_img,clr_img]=size(img_ori);
imshow(img_ori,'Parent',app.UIAxes)
This is an image I loaded in GUIDE, as you see there are X and Y Ticks. I want to see the same axis in the app designer. Could anyone help me figure out how to add the axis? Thanks!
0 个评论
采纳的回答
Image Analyst
2024-1-23
Did you try the axis function after you called imshow?
axis('on', 'image');
Under the image processing options/preferences you can set whether you want the axis to be visible by default or not if you use the imshow function (instead of the imagesc function).
2 个评论
Image Analyst
2024-1-24
That seems weird. It should only open a new figure if there is no axes control visible yet. But if there is an axes control on your figure GUI, then axis should work on the current axes, called "gca". If you haven't "used" the axes yet to display anything, then maybe gca is null and it opens a new axes on a new figure. But if you displayed something in the axes, then it should apply. You can pass in the axes handle that you want the command to operate on, so something like
axes(app.axes1, 'on', 'image'); % Turn the axes on for the axes1 control.
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!