How can I plot a string input?
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
David Hill
2022-9-29
figure
ax=gca;
t = text(0.5,0.5,'David');
s = t.FontSize;
t.FontSize = 12;
ax.Visible='off';
2 个评论
Matt J
2022-10-10
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.
更多回答(1 个)
David Hill
2022-9-29
I assume you want to display.
display('David')
txt =input('What is your name','s');
display(txt)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!