textscan(a,'%2d') %works fine
ans =
[5x1 int32]
>> ans{:}
ans =
1
4
6
5
11
dpb <none@non.net> wrote in message <kaihsc$t56$1@speranza.aioe.org>...
> On 12/15/2012 12:52 PM, dpb wrote:
> > On 12/15/2012 11:20 AM, Tiger wrote:
> >> Hi folks,
> >>
> >> Suppose the following:
> >> a = '1.4.6.5.11'; % String
> >>
> >> I want to be able to extract those numbers, in variable 'a',
> >> individually and assign them into another variable 'b', such b = {1, 4,
> >> 6, 5, 11};
> > ...
> >
> > b=sscanf(a,'%d.');
>
> >> a = '1.4.6.5.11';
> >> sscanf(a,'%d.')
> ans =
> 1
> 4
> 6
> 5
> 11
>
> BTW, the much ballyhoo'ed textscan() barfs on this one...
>
> >> textscan(a,'%d.')
> ans =
> [3x1 int32]
> >> ans{:}
> ans =
> 1
> 7
> 11
> >> >> textscan(a,'%d','delimiter','.')
> ans =
> [3x1 int32]
> >> ans{:}
> ans =
> 1
> 7
> 11
> >>
>
> It's not at all clear to me where it invented the '7' from and why it
> failed so miserably...
>
> Comments, TMW??? Bug or some intended behavior?
>
> --
ans =
[5x1 int32]
>> ans{:}
ans =
1
4
6
5
11
dpb <none@non.net> wrote in message <kaihsc$t56$1@speranza.aioe.org>...
> On 12/15/2012 12:52 PM, dpb wrote:
> > On 12/15/2012 11:20 AM, Tiger wrote:
> >> Hi folks,
> >>
> >> Suppose the following:
> >> a = '1.4.6.5.11'; % String
> >>
> >> I want to be able to extract those numbers, in variable 'a',
> >> individually and assign them into another variable 'b', such b = {1, 4,
> >> 6, 5, 11};
> > ...
> >
> > b=sscanf(a,'%d.');
>
> >> a = '1.4.6.5.11';
> >> sscanf(a,'%d.')
> ans =
> 1
> 4
> 6
> 5
> 11
>
> BTW, the much ballyhoo'ed textscan() barfs on this one...
>
> >> textscan(a,'%d.')
> ans =
> [3x1 int32]
> >> ans{:}
> ans =
> 1
> 7
> 11
> >> >> textscan(a,'%d','delimiter','.')
> ans =
> [3x1 int32]
> >> ans{:}
> ans =
> 1
> 7
> 11
> >>
>
> It's not at all clear to me where it invented the '7' from and why it
> failed so miserably...
>
> Comments, TMW??? Bug or some intended behavior?
>
> --