MATLAB Answers

0

incrementing over the alphabet???

Asked by Justin Sung on 26 Jun 2019
Latest activity Answered by Stephen Cobeldick on 26 Jun 2019
Accepted Answer by Jan
Hi all,
This is probably a silly question, but I was wondering if there was a way to increment over the alphabet similarily to how we increment a number. something similar to this:
count = 1;
while 1
count = count + 1
end
except instead of outputing a number that runs until your computer explodes, it does it for the alphabet. An output like this:
a, b, c, d, ... z
Is this possible? or is there some sort of ASCII incrementing I could do? It would make my program very pretty, and I like pretty programs.
Thanks in advance.

  0 Comments

Sign in to comment.

2 Answers

Jan
Answer by Jan
on 26 Jun 2019
Edited by Jan
on 26 Jun 2019
 Accepted Answer

count = 'a';
while 1
count = char(count + 1)
end

  0 Comments

Sign in to comment.


Answer by Stephen Cobeldick on 26 Jun 2019

>> for c = 'a':'z', disp(c), end
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
>>

  0 Comments

Sign in to comment.