Re: matlab fscanf



On dec. 2, 20:20, dpb <n...@xxxxxxx> wrote:
csordasp...@xxxxxxxxx wrote:
On dec. 2, 20:09, "David" <d...@xxxxxxxxxxxxxx> wrote:
csordasp...@xxxxxxxxx wrote in message <ac70556a-6b60-4f0a-804f-10ed13f69...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>...
...
I have a .txt file with rows like:
4980361404 SMP       1     569.41  372.51
I have need the 1.,4.,5. colums(4980361404, 569.41, 372.51).
...
'nothing' happened?  what does your code look like?

I tried:
1,a=fscanf(fid,['%d %s %d %d %d']);
2,a=fscanf(fid,['%d' 'SMP' '1' '%d %d']);

I hope (and will assume) the "1," and "2," are spurious trying to show
different attempts.  I'd suggest not murky-ing [sic] up the water that
way in the future -- it would be best to report only the exact
characters typed.  Otherwise, it's possible the intent to clarify will
simply obfuscate.  Here it's possible to figure what was probably
intended relatively easily; in other instances perhaps "not so much".

That said, I responded earlier.

I'd start w/ the

doc fscanf

as a recommendation to read the doc's more carefully; specifically the
"*" skip modifier and look at the type of data and the corresponding
format string more carefully (yes, I'm a Fortran, not C kinda' guy,
sorry :) ).

Anyway, try

a = fscanf(fid,'%f, %*s %*d %f %f');

I'll let you use the previous suggestion to check on the why's...

--

Thanks!
I read the doc:D
a = fscanf(fid,'%f, %*s %*d %f %f');
unfortunately this not good.I got just the first column.
.



Relevant Pages

  • Re: is int(round(val)) safe?
    ... >> Since round() returns an integer ... > Just to clarify in case anyone else misreads this, ... > I think the intent was clear from the rest of the post, ... > wouldn't hurt to clarify this for any newbies who misread it like I did. ...
    (comp.lang.python)
  • Re: is int(round(val)) safe?
    ... Just to clarify in case anyone else misreads this, ... here was to say that round(f) -- that is, ... I think the intent was clear from the rest of the post, ... wouldn't hurt to clarify this for any newbies who misread it like I did. ...
    (comp.lang.python)
  • Re: Am I asking too much when asking for a pic?
    ... Pin-Del....the cab is just north of Columbus Ohio. ... I never went as far as getting an exact address. ... I am learning alot from this thread. ... SELLER weed out me or people who really never had any intent on buying. ...
    (rec.games.pinball)
  • Re: Am I asking too much when asking for a pic?
    ... I never went as far as getting an exact address. ... I am learning alot from this thread. ... peoples shoes through the responses here. ... SELLER weed out me or people who really never had any intent on buying. ...
    (rec.games.pinball)
  • Re: When Overloading the Plus Operator, What are Valid Arguments Types?
    ... enthusiastically to pin down the root cause. ... family to clarify the intent. ...
    (microsoft.public.dotnet.languages.csharp)

Loading