How can I plot a string input?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mohammad Rastegarpanah
am 29 Sep. 2022
Kommentiert: Matt J
am 10 Okt. 2022
Hello,
How can I plot a string input?
prompt = "What is your name";
txt = input(prompt,"s");
if isempty(txt)
txt = 'Enter your name again.';
end
>> txt =
'MAX'
I want to automatically plot the received string.
0 Kommentare
Akzeptierte Antwort
David Hill
am 29 Sep. 2022
figure
ax=gca;
t = text(0.5,0.5,'David');
s = t.FontSize;
t.FontSize = 12;
ax.Visible='off';
2 Kommentare
Matt J
am 10 Okt. 2022
No, the text displayed on the plot by the text() command isn't formed from an underlying set of x,y points that can be plotted.
Weitere Antworten (1)
David Hill
am 29 Sep. 2022
I assume you want to display.
display('David')
txt =input('What is your name','s');
display(txt)
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!