From: Mike on
I am trying to read some numbers that are in scientific notation out of a string.

An example string is:

# Beam sigy = 0 m, muy = -2e-06 m, dy = 1e-06 m

where I need to read out:

0
-2e-06
1e-06

I have not been able to find a way to do this. I have played with textscan and regexp but no luck. Maybe someone has an idea?

Thanks,
--
Mike
From: Walter Roberson on
Mike wrote:
> I am trying to read some numbers that are in scientific notation out of
> a string.
>
> An example string is:
>
> # Beam sigy = 0 m, muy = -2e-06 m, dy = 1e-06 m
>
> where I need to read out:
>
> 0
> -2e-06
> 1e-06
>
> I have not been able to find a way to do this. I have played with
> textscan and regexp but no luck. Maybe someone has an idea?

Try a scan format of '%*[^=]%*[=]%f%*[m]'
From: Mike on
Walter Roberson <roberson(a)hushmail.com> wrote in message <Ari4o.4420$mW5.1426(a)newsfe14.iad>...
> Mike wrote:
> > I am trying to read some numbers that are in scientific notation out of
> > a string.
> >
> > An example string is:
> >
> > # Beam sigy = 0 m, muy = -2e-06 m, dy = 1e-06 m
> >
> > where I need to read out:
> >
> > 0
> > -2e-06
> > 1e-06
> >
> > I have not been able to find a way to do this. I have played with
> > textscan and regexp but no luck. Maybe someone has an idea?
>
> Try a scan format of '%*[^=]%*[=]%f%*[m]'

I tried doing textscan(line, '%*[^=]%*[=]%f%*[m]') and I get an output of

ans = [3x1 double]

not sure what the issue is and I also don't understand what your format is saying/doing?