How do I get user input and converts each character to specific string

 Respuesta aceptada

If i'm just supposed to guess, then:
% one char vec for each a b c, etc
symbols = {'.-' '..' '--' 'dee' 'ee' 'eff' 'gee'};
% input
invec = 'adgfcbe';
% assemble output
outtvec = horzcat(symbols{double(lower(invec))-double('a')+1})
outtvec = '.-deegeeeff--..ee'

4 comentarios

i am using the edit text box for user to enter input is there anyway where i can get input from there
i am doing something like a translate program
If this is part of a gui, you'll have to deal with that in the callback that you specified for that object, or you'll have to otherwise access the appropriate properties of that object in order to get the string that's in the box.
kkkrdrr
kkkrdrr el 12 de Abr. de 2022
Editada: kkkrdrr el 12 de Abr. de 2022
i am currently still facing error output couldn't display in specific box

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Characters and Strings en Centro de ayuda y File Exchange.

Preguntada:

el 11 de Abr. de 2022

Editada:

el 12 de Abr. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by