How do i change the input to make it any word I type in?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mohannad Abboushi
el 30 de Mzo. de 2016
Respondida: Walter Roberson
el 30 de Mzo. de 2016
In this program I am supposed to take a character array s as input and return a new character array with each letter shifted forward once in the alphabet (Assuming that the input s will never contain the letter 'z'.)
So far here's my code:
function S = shiftletters('apple')
S=char('a':'z'+1);
0 comentarios
Respuesta aceptada
Walter Roberson
el 30 de Mzo. de 2016
In a function line, you need to name a variable that will receive the passed value, such as
function S = shiftletters(TheInputWord)
Then inside the function your code should act upon the contents of that variable name (such as TheInputWord). For example to reverse the input you could use
fliplr(TheInputWord)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Operators and Elementary Operations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!