Memory overflown for the number to be saved
Mostra commenti meno recenti
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 Commenti
Oleg Komarov
il 10 Set 2012
Where do you get the error?
Also, how do you create A?
Avinash bachu
il 10 Set 2012
Oleg Komarov
il 10 Set 2012
Do not double post.
Then what is CI? How do you get it?
Avinash bachu
il 10 Set 2012
Risposta accettata
Più risposte (1)
Oleg Komarov
il 10 Set 2012
Modificato: Oleg Komarov
il 10 Set 2012
cs = regexp(A,'(?<=IMSI=)\d+','match');
str2double(cs{:})
5 Commenti
Avinash bachu
il 10 Set 2012
Oleg Komarov
il 10 Set 2012
@Avinash: I did not encounter the problem with your example. Do you have longer numbers?
Avinash bachu
il 10 Set 2012
Oleg Komarov
il 10 Set 2012
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'.
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!