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

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))
>> s = '100a50b';
>> v = sscanf(s,'%d%*c')
v =
100
50

댓글을 달려면 로그인하십시오.

 채택된 답변

Akira Agata
Akira Agata 2018년 10월 25일

1 개 추천

How about the following?
str = input('Enter with input: ','s');
c = regexp(str,'\d+','match');
output = str2double(c);

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by