Azzera filtri
Azzera filtri

incrementing over the alphabet???

33 visualizzazioni (ultimi 30 giorni)
Justin Sung
Justin Sung il 26 Giu 2019
Risposto: Stephen23 il 26 Giu 2019
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.

Risposta accettata

Jan
Jan il 26 Giu 2019
Modificato: Jan il 26 Giu 2019
count = 'a';
while 1
count = char(count + 1)
end

Più risposte (1)

Stephen23
Stephen23 il 26 Giu 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
>>

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by