Re: one line data from text file , Where the end position is unknown



mathone wrote:

I have to read a textfile either using textread or textscan to read columns of a particular row of data, where the number of columns vary with each file. I've been able to start at that particular row , but how should i make matlab stop at the end of that row?.

That is not at all easy in general, not unless you know exactly how wide that column should be. If you do not know how wide the column should be, then chances are strong that you will need to read up to and including the character(s) that signal the end of line, which would leave you positioned at the beginning of the next line rather than at the end of the current one.

Chances are, though, that the beginning of the line is where you want to end up, unless you are trying to write more data on to the end of the line -- but if _that_ is what you are trying to do, you are unlikely to be able to do it (writing into the middle of a text file is quite tricky to get right, and I advise against it. Writing into the middle of a binary file is relatively easier, but still advised against in under ordinary circumstances.)
.



Relevant Pages

  • Re: Target Readership?
    ... > me to spend so much time writing. ... > deal with submitting a book for publishing. ... > lot of pressure for the first book to fly (yes, ... I don't think you hugely increase the chances of making a book sell by ...
    (rec.arts.sf.composition)
  • Re: C Program Portability
    ... Now, since this is a binary file, any transfer is likely to ... that any code writing data as a binary file needs to be adapted for the ... It's more that if you are dealing with reading, processing, writing a ... binary format (say, doing some image processing on a greyscale image ...
    (comp.lang.c)
  • Re: multi-file programs - main.c recommended?
    ... or is there an unspoken rule. ... chances are that the file that contained mainwould be ... Strangely enough, if I were writing a program to play chess, ...
    (comp.lang.c)
  • Re: Writing a serial number to EEPROM...
    ... Where are you actually writing to EE? ... have used the hex2bix method, ... upload the new binary file to the FX2 EEPROM. ... writing to the USB device, ...
    (comp.arch.embedded)
  • Re: save image from http
    ... my eyes hurt and pain after tens hours of writing. ... > binary file. ... >> now I can connect to source file (in specified url location), ... >> I'm sure I start to download correct file, ...
    (microsoft.public.pocketpc.developer)