program that returns random letter

program that returns random letter

2 Comments

John D'Errico
John D'Errico on 28 Jan 2018
Edited: John D'Errico on 28 Jan 2018
Please don't delete your question. That insults the person who spent the time to answer it. It also makes it less likely that individual will bother to answer another of your questions.
You hurt Answers as a site, because it leaves meaningless answers, since there is no longer a question that they solve. And flagging your own question as spam is just foolishness. It looks like the question has been restored now, so this has been repaired.
(Answers Dev) Restored edit

Sign in to comment.

 Accepted Answer

Stephen23
Stephen23 on 28 Jan 2018
Edited: Stephen23 on 28 Jan 2018
char(randi([65,90]))
char(randi(+'AZ'))

More Answers (1)

Start here:
UCL = 'A':'Z'; % Vector Of Uppercase Letters
then choose one!

3 Comments

John D'Errico
John D'Errico on 28 Jan 2018
Edited: John D'Errico on 28 Jan 2018
Funny. I never realized that colon works on chars. Of course, it makes sense that it could do so. One of the things that I like about Answers, I can always learn something.
@John D'Errico: Not only is this very convenient, it also removes the possibility of missing a letter when building lists for comparison. Very handy!
I gave an appropriate hint, while not giving a complete solution to what is obviously a homework problem, and for which the OP had shown no effort.

Sign in to comment.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!