Prev: How to generate random matrix with constraints?
Next: Can I define my own variable size in memory other than UINT16, UINT32, etc...?
From: dpb on 7 Jul 2010 16:16 dpb wrote: > And even more discouraging... > > >> strrep(s,' ','0') > ans = > 0030012.5 > >> [x,y,z]=strread(s,'%3d%3d%3.1f',1) > x = > 3 > y = > 12 > z = > 0.5000 > >> > > It pays no attention to the width specifier and parses to the '.' for > the second value, apparently. .... That's a mistake; I didn't save the substituted string and redid the same thing w/ embedded blanks again w/o thinking. The parsing of '0030012.5' _DOES_ work w/ a field width specification so that would be another way, potentially. I posted another query on the behavior; be interesting to see if it generates any (useful) response(s)... --
From: Peter Riddersholm on 8 Jul 2010 02:19 Wow, I never thought something that simple would turn out so difficult! Thanks a lot for your help - I think I've got it working now... Peter dpb <none(a)non.net> wrote in message <i12ng9$7t3$1(a)news.eternal-september.org>... > dpb wrote: > > And even more discouraging... > > > > >> strrep(s,' ','0') > > ans = > > 0030012.5 > > >> [x,y,z]=strread(s,'%3d%3d%3.1f',1) > > x = > > 3 > > y = > > 12 > > z = > > 0.5000 > > >> > > > > It pays no attention to the width specifier and parses to the '.' for > > the second value, apparently. > ... > > That's a mistake; I didn't save the substituted string and redid the > same thing w/ embedded blanks again w/o thinking. > > The parsing of '0030012.5' _DOES_ work w/ a field width specification so > that would be another way, potentially. > > I posted another query on the behavior; be interesting to see if it > generates any (useful) response(s)... > > --
From: dpb on 8 Jul 2010 08:57
Peter Riddersholm wrote: > Wow, I never thought something that simple would turn out so difficult! > > Thanks a lot for your help - I think I've got it working now... .... It surely _ought_NOT_ be but is, owing I suppose to the slavish (now, unfortunately, irreversible) following of C-style i/o formatting syntax. Too bad TMW didn't have the foresight to have dumped it in favor of more Fortran-like behavior and add the useful extensions such as the field skip asterisk, etc. Anyway, glad you finally got something going...what did you finally end up doing? And, btw, so far the other thread has engendered no substantive response other than one other unhappy camper... :( -- |