Memory overflown for the number to be saved
이전 댓글 표시
Hi
I have string like this.
A={'IMSI=208016702935545 CI=20796 LAC=29188'};
I have done this
imsi=regexp(A,'\w*IMSI=\w*','match');
After doing that I get
imsi{1,1}= 'IMSI=208016702935545';
Again I do this to extract the numbe out of it
cellinfo=sscanf(char(imsi{1,1}),'%*5c%d');
But the length of IMSI is too long and is overflown. can anyone suggest something so that I can have cellinfo=208016702935545 ;
Thanks in advance
Avinash
댓글 수: 4
Oleg Komarov
2012년 9월 10일
Where do you get the error?
Also, how do you create A?
Avinash bachu
2012년 9월 10일
Oleg Komarov
2012년 9월 10일
Do not double post.
Then what is CI? How do you get it?
Avinash bachu
2012년 9월 10일
채택된 답변
추가 답변 (1개)
Oleg Komarov
2012년 9월 10일
편집: Oleg Komarov
2012년 9월 10일
cs = regexp(A,'(?<=IMSI=)\d+','match');
str2double(cs{:})
댓글 수: 5
Avinash bachu
2012년 9월 10일
Oleg Komarov
2012년 9월 10일
@Avinash: I did not encounter the problem with your example. Do you have longer numbers?
Avinash bachu
2012년 9월 10일
Oleg Komarov
2012년 9월 10일
The '\d+' part in the regexp() does not relate to the sscanf() syntax.
cs = regexp(A,'(?<=IMSI=)\d+','match')
The line identifies characters belonging to the set '1234567890'.
카테고리
도움말 센터 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!