How can I plot a string input?

1 vue (au cours des 30 derniers jours)
Mohammad Rastegarpanah
Mohammad Rastegarpanah le 29 Sep 2022
Commenté : Matt J le 10 Oct 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.

Réponse acceptée

David Hill
David Hill le 29 Sep 2022
figure
ax=gca;
t = text(0.5,0.5,'David');
s = t.FontSize;
t.FontSize = 12;
ax.Visible='off';
  2 commentaires
Mohammad Rastegarpanah
Mohammad Rastegarpanah le 29 Sep 2022
Is it possible to extract X and Y for each letter as a list?
Matt J
Matt J le 10 Oct 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.

Connectez-vous pour commenter.

Plus de réponses (1)

David Hill
David Hill le 29 Sep 2022
I assume you want to display.
display('David')
David
txt =input('What is your name','s');
display(txt)
  1 commentaire
Mohammad Rastegarpanah
Mohammad Rastegarpanah le 29 Sep 2022
Thanks for your response. What I looking for is to plot the output not display it.

Connectez-vous pour commenter.

Catégories

En savoir plus sur Cell Arrays dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by