How to display x and y axis to an image in app designer
조회 수: 22 (최근 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!