用正则表达式匹配吧:
>> s = '[数字一12000] [数字二28000]'
s =
[数字一12000] [数字二28000]
>> ms = regexp( s, '(?<=\w+)\d+', 'match' )
ms =
'12000' '28000'
然后将字符串转换为数字:
>> num1 = str2num( ms{ 1 } )
num1 =
12000
a='[数字一12000] [数字二28000]';
index1=strfind(a,'一');
index2=strfind(a,'二');
index3=strfind(a,']');
num1=a(index1+1:index3(1)-1)
num2=a(index2+1:index3(2)-1)