input alphabet and numbers

4 visualizaciones (últimos 30 días)
Theodoros Siapakas
Theodoros Siapakas el 24 de Oct. de 2018
Comentada: Theodoros Siapakas el 25 de Oct. de 2018
how can I give an entry order numbers and letters together and after reading only their numbers for doing?
such as
x=input('alpanub')
x=100a50b
y=100
c=50
  2 comentarios
Erivelton Gualter
Erivelton Gualter el 25 de Oct. de 2018
Run the following code, it may give you some insight
name = input('Enter with input: ','s');
name_binary = isletter(name);
idx = find(name_binary == 0);
str2num(name(idx))
Stephen23
Stephen23 el 25 de Oct. de 2018
>> s = '100a50b';
>> v = sscanf(s,'%d%*c')
v =
100
50

Iniciar sesión para comentar.

Respuesta aceptada

Akira Agata
Akira Agata el 25 de Oct. de 2018
How about the following?
str = input('Enter with input: ','s');
c = regexp(str,'\d+','match');
output = str2double(c);
  1 comentario
Theodoros Siapakas
Theodoros Siapakas el 25 de Oct. de 2018
thank you for your immediate answer

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Logical 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!

Translated by