"us " <us@neurol.unizh.ch> wrote in message
<f9mkll$3hr$1@fred.mathworks.com>...
> Varun:
> <SNIP importing formatted text evergreen...
>
> > Is there an efficient way to read just the numbers after
> the first line into a [m,n] matrix...
>
> one of the many solutions
>
> % assume your data is in <foo.txt>
> fnam='foo.txt';
> m=dlmread(fnam,',',1,0);
Subject: Problem regarding data analysis containing string in the file
I really need your help. I want to pick the value of last
coulumn (value of after n), rainrate value and time only and
putting them in new file with structure as desired new file.
That's my question, thanks very much for your best help
Best regards;
Edward
Subject: Re: Problem regarding data analysis containing string in the file
On Tue, 12 Feb 2008 11:02:02 -0500, edward kabanyas <djuky_hmi@yahoo.com=
> =
wrote:
> Dear All,
> I have problem in reading file containing string or
> character in my file. The following are the data example:
>
> 11:48:00 -> 11:49:00 0.00 -> 0.25 mm n=3D 0.0000000 /m3mm
> 11:48:00 -> 11:49:00 0.25 -> 0.50 mm n=3D 0.0000000 /m3mm
> 11:48:00 -> 11:49:00 0.50 -> 0.75 mm n=3D 0.0000000 /m3mm
> 11:48:00 -> 11:49:00 0.75 -> 1.00 mm n=3D 1.8491934 /m3mm
> rainrate =3D0.001686 mm/hr
> 11:49:00 -> 11:50:00 0.00 -> 0.25 mm n=3D 0.0000000 /m3mm
> 11:49:00 -> 11:50:00 0.25 -> 0.50 mm n=3D 0.0000000 /m3mm
> 11:49:00 -> 11:50:00 0.50 -> 0.75 mm n=3D 2.6686186 /m3mm
> 11:49:00 -> 11:50:00 0.75 -> 1.00 mm n=3D 0.0000000 /m3mm
> rainrate =3D0.000455 mm/hr
> 11:50:00 -> 11:51:00 0.00 -> 0.25 mm n=3D 0.0000000 /m3mm
> 11:50:00 -> 11:51:00 0.25 -> 0.50 mm n=3D 0.0000000 /m3mm
> 11:50:00 -> 11:51:00 0.50 -> 0.75 mm n=3D 2.3139154 /m3mm
> 11:50:00 -> 11:51:00 0.75 -> 1.00 mm n=3D 3.5420286 /m3mm
> rainrate =3D0.004181 mm/hr
>
> Desired new file structure:
> 11:48:00 0.0000000 0.0000000 0.0000000 1.8491934 0.001686
> 11:49:00 0.0000000 0.0000000 2.6686186 0.0000000 0.000455
> 11:50:00 0.0000000 0.0000000 2.3139154 3.5420286 0.004181
>
> I really need your help. I want to pick the value of last
> coulumn (value of after n), rainrate value and time only and
> putting them in new file with structure as desired new file.
>
> That's my question, thanks very much for your best help
>
> Best regards;
> Edward
>
If you didn't have two "kinds" of lines, textscan would be helpful.
But it sounds to me like you'll have to "manually" open the file,
read it line by line, and find the last number in each line, e.g.
use the following functions:
fopen to open the file
fgetl to read a line
sscanf or other string functions to parse the line
fclose to close the file
Public Submission Policy
NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for
all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content.
Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available
via MATLAB Central. Read the complete Disclaimer prior to use.