Ok, there are much more elegant ways to solve this, but my following example will give you a feeling on how to manipulate strings in MatLab (Which might be the thing you are having problems with). Here you go:
String='20130806_083642832,!AIVDM,1,1,,B,13aFeA0P00PEqQNNC4Um7Ow`2@O2,0*5E'
for i=1:length(String)
if(strcmp(String(i),'B')) %or strcmp(String(i),'A')
for j=i:length(String) %or "for j=length(String):i" if you meant the last 0 ;)
if(strcmp(String(j),'0'))
String2=String(i:j)
break
end
end
break
end
end
Output
String =
20130806_083642832,!AIVDM,1,1,,B,13aFeA0P00PEqQNNC4Um7Ow`2@O2,0*5E
String2 =
B,13aFeA0
Just play around with string indexing and with strcmp
or strcmpi
and you'll get a feeling and will be able to write much nicer expressions.
Now try extracting the date by yourself!
Hope that helps!