I guess you could do this:
markers = strread(data,'%f','delimiter','*#;');
markers(markers==0)=[];
Hope this helps.
"Kian " <kian.torab@utah.edu> wrote in message <h14aa9$5r9$1@fred.mathworks.com>...
> Last question for a few days, promise.
>
> How do I pull out the numbers out of this string WITHOUT a loop?
>
> data = '*12#;*123#;*1122#;*2#;*6312#;*112#;*1251#;*1912#;*8612#;
>
> I basically want to be able to pull out the numbers, such as I'll have:
>
> markers = [12, 123, 1122, 2, 6312, 112, 1251, 1912, 8612];
>
> I can do this ONLY IF all the numbers are the same length (e.g. 3 digit numbers) using the indices of the '*'s and '#'s and bsxfun, but I don't know how to do it when the lengths are different. This is what I'd do if the lengths were the same.
>
> starIndices = find(data == '*');
> poundIndices = find(data == '#');
>
> data(bsxfun(@plus, starIndices, 1:(poundIndicesstarIndices)1);
>
> But this only will give me the first 2 digits (since the first number in the string is only 2 digits long and that bsxfun will only use that to do its thing).
>
> Any easier way to do this?
>
> Thanks a lot for your time!
