Hi, in my script i would like to write some variables values on a figure that i call it from a pushbutton Gui oriented. How can i call the figure in the right way and writting on it in a specific position of my picture.
PS: Notice i won't have axis to be oriented, but i don't know if this will be a problem or not.
Thanks in advance!

 채택된 답변

KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 11월 27일
편집: KALYAN ACHARJYA 2018년 11월 27일

2 개 추천

This is an example
t=1:.01:10;
d=1; % here d is variable
dim=[0.5, 0.2, 0.1, 0.1]; %From here you can location the position of text
plot(sin(t));
str=sprintf('%.2f',d); %if No floting varibale number, use %d
annotation('textbox',dim,'String',str,'FitBoxToText','on');
99.png
For detail, check here

댓글 수: 4

Jucimar Carpe
Jucimar Carpe 2018년 11월 27일
Hi Kalyan, thank you for you answer!
The figure i want to show is a .jpg file and i want to write on it, it's not a plot, i've tried to do it in the way you said but didn't worked for me.
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 11월 27일
편집: KALYAN ACHARJYA 2018년 11월 27일
d=1;
im=imread('test.jpg');
position=[1 50];
box_color ={'red'};
text_str=sprintf('%.2f',d);
RGB=insertText(im,position,text_str,'FontSize',18,'BoxColor',box_color,'BoxOpacity',0.4,'TextColor','white');
figure
imshow(RGB)
pp.png
Detail is here, its easy
Jucimar Carpe
Jucimar Carpe 2018년 11월 27일
Hey Kalyan, thank you very much! works perfectly!!!
KALYAN ACHARJYA
KALYAN ACHARJYA 2018년 11월 27일
편집: KALYAN ACHARJYA 2018년 11월 27일
Welcome @Jucimar
I am glad, it helped.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2015a

질문:

2018년 11월 27일

편집:

2018년 11월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by