From: dpb on 13 Jul 2010 17:28 samik bhattacharya wrote: > dpb <none(a)non.net> wrote in message > <i1ieag$f37$1(a)news.eternal-september.org>... .... >> I missed this, too, first go but--look _very_ carefully at the format >> string and the data line at the location where the first go-round >> failed and see if you see the problem therein. >> >> --hi, > I did not quite get your procedure. To use textscan I need to know the > exact format. But I tried to use c=textscan(fp,'%s %f\t %s %f\t %s %f\t > %s %f'); > OR > c=textscan(fp,'%s %f %s %f %s %f %s %f '); > none worked > anyway, thanks again for your effort > samik You don't need any more exact knowledge w/ textscan than you do w/ fscanf The difficulty in the first that I was point you at is in the following... The data line-- Step = 1 z = 0.0000 U_pitot= 8.030 U = 7.168 To read this, I used the following line of codes: .... s=fscanf(fp,'U=%f'); Note there's no string 'U=' in the data line. >> l='Step = 1 z = 0.0000 U_pitot = 8.030 U= 7.168'; >> v=sscanf(l,'%*s = %f%*s = %f%*s = %f%*s%f') v = 1.0000 0 8.0300 7.1680 >> I've a version that predates textscan() here so can't actually do an example, but the above should be a hint. --
From: samik bhattacharya on 13 Jul 2010 18:37 dpb <none(a)non.net> wrote in message <i1ilu9$icb$1(a)news.eternal-september.org>... > samik bhattacharya wrote: > > dpb <none(a)non.net> wrote in message > > <i1ieag$f37$1(a)news.eternal-september.org>... > ... > >> I missed this, too, first go but--look _very_ carefully at the format > >> string and the data line at the location where the first go-round > >> failed and see if you see the problem therein. > >> > >> --hi, > > I did not quite get your procedure. To use textscan I need to know the > > exact format. But I tried to use c=textscan(fp,'%s %f\t %s %f\t %s %f\t > > %s %f'); > > OR > > c=textscan(fp,'%s %f %s %f %s %f %s %f '); > > none worked > > anyway, thanks again for your effort > > samik > > You don't need any more exact knowledge w/ textscan than you do w/ fscanf > > The difficulty in the first that I was point you at is in the following... > > The data line-- > Step = 1 z = 0.0000 U_pitot= 8.030 U = 7.168 > > To read this, I used the following line of codes: > ... > s=fscanf(fp,'U=%f'); > > Note there's no string 'U=' in the data line. > > >> l='Step = 1 z = 0.0000 U_pitot = 8.030 U= 7.168'; > >> v=sscanf(l,'%*s = %f%*s = %f%*s = %f%*s%f') > v = > 1.0000 > 0 > 8.0300 > 7.1680 > >> > > I've a version that predates textscan() here so can't actually do an > example, but the above should be a hint. > > --Hi, Ya I just ignored the '=' sign and wrote s=fscanf(fp,'%*s%f\t') to read U = 7.168 and it worked. But why it ignores'=' for this particular case? samik
First
|
Prev
|
Pages: 1 2 Prev: resid function - System Identification Toolbox Next: restoration of signal |