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 件のコメント

Erivelton Gualter
Erivelton Gualter 2018 年 10 月 25 日
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 2018 年 10 月 25 日
>> 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);

1 件のコメント

Theodoros Siapakas
Theodoros Siapakas 2018 年 10 月 25 日
thank you for your immediate answer

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by