Prev: ecg project
Next: spdiags()
From: mathone on 16 May 2010 08:56 Dear friends , 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?. Thanks and Best Regards
From: dpb on 16 May 2010 13:27 mathone wrote: .... > I have to read a text file 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?. I presume you know a priori how many columns are in each file; if so use the optional count argument to control the number of entries to read. If not, you're probably better off to go to lower level and return a full line as a string and parse it instead. Examples might help if the above is still unclear. --
From: Walter Roberson on 16 May 2010 14:09 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.)
|
Pages: 1 Prev: ecg project Next: spdiags() |