From: Mike on 29 Jul 2010 12:31 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 29 Jul 2010 12:59 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 29 Jul 2010 13:16 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?
|
Pages: 1 Prev: xPC Target: xpctest diagnostic failing at Test 4 Next: Please Somebody Help! Digital hologram |