<html><body>
<p>Hello,<br>
<br>
Did you try the fscanfMat function to read the file? The following two lines seems to do the job, if I really got the question:<br>
<br>
<font face="Courier New">f = xgetfile()   // locate the file</font><br>
<font face="Courier New">m = fscanfMat(f) // read the file over matrix m</font><br>
<br>
You get<br>
<br>
<font face="Courier New"> m  =</font><br>
<font face="Courier New"> </font><br>
<font face="Courier New">    274.    1.     0.2898  </font><br>
<font face="Courier New">    274.    2.     0.2919  </font><br>
<font face="Courier New">    274.    4.     0.2939  </font><br>
<font face="Courier New">    274.    7.     0.299   </font><br>
<font face="Courier New">    274.    10.    0.3035  </font><br>
<font face="Courier New">    274.    13.    0.313   </font><br>
<font face="Courier New">    274.    16.    0.3172  </font><br>
<font face="Courier New">    274.    20.    0.3201  </font><br>
<font face="Courier New">    274.    24.    0.3243  </font><br>
<font face="Courier New">    274.    27.    0.3272  </font><br>
<font face="Courier New">    274.    30.    0.33    </font><br>
<font face="Courier New">    274.    33.    0.321   </font><br>
<font face="Courier New">    274.    36.    0.3223  </font><br>
<font face="Courier New">    274.    40.    0.3236  </font><br>
<font face="Courier New">    274.    44.    0.3258  </font><br>
<font face="Courier New">    274.    48.    0.3273  </font><br>
<font face="Courier New">    274.    53.    0.3302  </font><br>
<font face="Courier New">    274.    57.    0.3345  </font><br>
<font face="Courier New">    274.    60.    0.3381  </font><br>
<font face="Courier New">    274.    63.    0.3331  </font><br>
<br>
The input file I used is (I supressed a line begining with a "1"; header lines should not start with a number):<br>
<br>
<font face="Courier New">*****************************</font><br>
<font face="Courier New">* Subplot Definitions *</font><br>
<font face="Courier New">*****************************</font><br>
<br>
<font face="Courier New">*****************************</font><br>
<font face="Courier New">* COLUMN LABELS *</font><br>
<font face="Courier New">*****************************</font><br>
<font face="Courier New">*****************************</font><br>
<font face="Courier New">DAY</font><br>
<font face="Courier New">DEPTH (CM)</font><br>
<font face="Courier New">SOIL WATER CONTENT (VOL)</font><br>
<font face="Courier New">****************** DATA STARTS HERE *****************</font><br>
<font face="Courier New">274 1.000 0.2898</font><br>
<font face="Courier New">274 2.000 0.2919</font><br>
<font face="Courier New">274 4.000 0.2939</font><br>
<font face="Courier New">274 7.000 0.2990</font><br>
<font face="Courier New">274 10.00 0.3035</font><br>
<font face="Courier New">274 13.00 0.3130</font><br>
<font face="Courier New">274 16.00 0.3172</font><br>
<font face="Courier New">274 20.00 0.3201</font><br>
<font face="Courier New">274 24.00 0.3243</font><br>
<font face="Courier New">274 27.00 0.3272</font><br>
<font face="Courier New">274 30.00 0.3300</font><br>
<font face="Courier New">274 33.00 0.3210</font><br>
<font face="Courier New">274 36.00 0.3223</font><br>
<font face="Courier New">274 40.00 0.3236</font><br>
<font face="Courier New">274 44.00 0.3258</font><br>
<font face="Courier New">274 48.00 0.3273</font><br>
<font face="Courier New">274 53.00 0.3302</font><br>
<font face="Courier New">274 57.00 0.3345</font><br>
<font face="Courier New">274 60.00 0.3381</font><br>
<font face="Courier New">274 63.00 0.3331</font><br>
<br>
Osvaldo<br>
<br>
<tt>"isuzman" <isuzman@gmail.com> wrote on 13/05/2009 01:45:43:<br>
<br>
> Hi Hari,</tt><br>
<tt>> Thanks much for your support. Attached is my reply to Prof. <br>
> Ramachandran. Hope it could give you another perspective. </tt><br>
<tt>> Best, </tt><br>
<tt>> Zhiming</tt><br>
<tt>>  </tt><br>
<tt>> Dear Dr. Ramachandran,</tt><br>
<tt>>  </tt><br>
<tt>> Thank you very much! That's exactly what I want. The main problem is<br>
> that I only know read('filename.txt', m, n) statement, and it could <br>
> not work for data mixed with characters. I tried a lot and never <br>
> find read statemtne like A=read("data.txt",-1,1,"(a)"). It helps a lot.</tt><br>
<tt>>  </tt><br>
<tt>> I kind of solved this problem by using file statement:</tt><br>
<tt>>  </tt><br>
<tt>> A =[]; B=[]; C=[];<br>
> v=file('open', 'data.txt', 'old');<br>
> for i = 1:36000<br>
>  if i<=12 then Head=fscanf(v, '%s');        // there is 12 headlines;<br>
>    else [AA BB CC]=fscanf(v, '%f %f %f');<br>
>         A=[A; AA]; B=[B; BB]; C=[C; CC];<br>
> end<br>
> end</tt><br>
<tt>> // the data I want is</tt><br>
<tt>>  [A, B, C]</tt><br>
<tt>>  </tt><br>
<tt>> Your read statement is so good that I do not have to write so long a<br>
> program. I really appreciate your help.</tt><br>
<tt>> Thanks much and have a great day,</tt><br>
<tt>>  </tt><br>
<tt>> Zhiming</tt><br>
<tt>> Iowa State University</tt><br>
<tt>> Agricultural Engineering Department</tt><br>
<tt>>  </tt><br>
<tt>>  </tt><br>
<tt>>  </tt><br>
<tt>>  </tt><br>
<tt>>  </tt><br>
<tt>> 2009-05-12 </tt><br>
<tt>> <br>
> isuzman </tt><br>
<tt>> <br>
> 发件人: Giri </tt><br>
<tt>> 发送时间: 2009-05-08  09:32:31 </tt><br>
<tt>> 收件人: users@lists.scilab.org </tt><br>
<tt>> 抄送: </tt><br>
<tt>> 主题: Re: [scilab-Users] Help in reading txt file: how to skip the title </tt><br>
<tt>> harishankar ramachandran wrote:</tt><br>
<tt>>  </tt><br>
<tt>> > The following program does the specific job:</tt><br>
<tt>> ></tt><br>
<tt>> > // to read in a data file containing header lines starting with</tt><br>
<tt>> > // "*" and to read in the columns after the last header line.</tt><br>
<tt>> > A=read("data.txt",-1,1,"(a)"); // read in the file</tt><br>
<tt>> > jj=grep(A,"*"); // find lines containing "*"</tt><br>
<tt>> ></tt><br>
<tt>> > // We want to skip upto all lines containing "*" So start after</tt><br>
<tt>> > // the last such line</tt><br>
<tt>> > ibeg=jj(length(jj))+1;</tt><br>
<tt>> > iend=size(A,"r");</tt><br>
<tt>> > m=iend-ibeg+1;</tt><br>
<tt>> > [n,v1,v2,v3]=msscanf(m,A(ibeg:iend),"%f %f %f");</tt><br>
<tt>> ></tt><br>
<tt>> > clf</tt><br>
<tt>> > subplot(3,1,1);</tt><br>
<tt>> > plot2d(1:m,v1');</tt><br>
<tt>> > subplot(3,1,2);</tt><br>
<tt>> > plot2d(1:m,v2');</tt><br>
<tt>> > subplot(3,1,3);</tt><br>
<tt>> > plot2d(1:m,v3');</tt><br>
<tt>> ></tt><br>
<tt>> > // Note that this script hardcoded the number of columns and does</tt><br>
<tt>> > // no error checking. Since column information is present in the</tt><br>
<tt>> > // file, one could also extract that info and construct the</tt><br>
<tt>> > // format string appropriately. Or use the logic in fscanfMat to directly</tt><br>
<tt>> > // figure out the number of columns.</tt><br>
<tt>> ></tt><br>
<tt>> > Not sure this is quite what you wanted.</tt><br>
<tt>> ></tt><br>
<tt>> > regards</tt><br>
<tt>> ></tt><br>
<tt>> > hari ramachandran</tt><br>
<tt>> ></tt><br>
<tt>> > On Wednesday 06 May 2009 21:49, Zhiming Qi wrote:</tt><br>
<tt>> >  > *****************************</tt><br>
<tt>> >  > * Subplot Definitions *</tt><br>
<tt>> >  > *****************************</tt><br>
<tt>> >  > 1</tt><br>
<tt>> >  > *****************************</tt><br>
<tt>> >  > * COLUMN LABELS *</tt><br>
<tt>> >  > *****************************</tt><br>
<tt>> >  > DAY</tt><br>
<tt>> >  > DEPTH (CM)</tt><br>
<tt>> >  > SOIL WATER CONTENT (VOL)</tt><br>
<tt>> >  > ****************** DATA STARTS HERE *****************</tt><br>
<tt>> >  > 274 1.000 0.2898</tt><br>
<tt>> >  > 274 2.000 0.2919</tt><br>
<tt>> >  > 274 4.000 0.2939</tt><br>
<tt>> >  > 274 7.000 0.2990</tt><br>
<tt>> >  > 274 10.00 0.3035</tt><br>
<tt>> >  > 274 13.00 0.3130</tt><br>
<tt>> >  > 274 16.00 0.3172</tt><br>
<tt>> >  > 274 20.00 0.3201</tt><br>
<tt>> >  > 274 24.00 0.3243</tt><br>
<tt>> >  > 274 27.00 0.3272</tt><br>
<tt>> >  > 274 30.00 0.3300</tt><br>
<tt>> >  > 274 33.00 0.3210</tt><br>
<tt>> >  > 274 36.00 0.3223</tt><br>
<tt>> >  > 274 40.00 0.3236</tt><br>
<tt>> >  > 274 44.00 0.3258</tt><br>
<tt>> >  > 274 48.00 0.3273</tt><br>
<tt>> >  > 274 53.00 0.3302</tt><br>
<tt>> >  > 274 57.00 0.3345</tt><br>
<tt>> >  > 274 60.00 0.3381</tt><br>
<tt>> >  > 274 63.00 0.3331</tt><br>
<tt>> ></tt><br>
<tt>> > --</tt><br>
<tt>> > Dr. Hari Ramachandran, Professor, 332B ESB, EE Dept, IIT-Madras</tt><br>
<tt>> > Interests: Nonlinear Optics, Nonlinear Waves, Plasma Physics, Particle</tt><br>
<tt>> >            Simulations, Computational Algorithms, Linux.</tt><br>
<tt>> > Off: 91-44-2257-4421                    Fax: 91-44-2257-0120</tt><br>
<tt>> > Res: 91-44-2663-1863             Home Email: omkarbharathi@gmail.com</tt><br>
<tt>>  </tt><br>
<tt>> Dear Prof. Ramachandran:</tt><br>
<tt>> Thanks for the detailed solution, this is a common problem faced</tt><br>
<tt>> by anyone trying process data obtained from lab instruments. I was</tt><br>
<tt>> also planning to post some similar question as I am new user of</tt><br>
<tt>> Scilab. Thanks to Mr Qi also!</tt><br>
<tt>> Sincerely,</tt><br>
<tt>> Giridhar</tt><br>
<tt>>  </tt><br>
<tt>> --</tt><br>
<tt>> M. S. Giridhar</tt><br>
<tt>> Thinfilms and Microsensors Group</tt><br>
<tt>> Laboratory for Electro Optic Systems</tt><br>
<tt>> Indian Space Research Organisation</tt><br>
<tt>> 1st Cross, 1st Stage, Peenya Industrial Estate,</tt><br>
<tt>> Bangalore 560058.</tt><br>
<tt>> Phone:2839 2294, 2839 2291 ext 2212</tt><br>
<tt>>  </tt><br>
<tt>>  </tt><br>
<tt>>  </tt><br>
<tt>> ----------------------------------------------------------------</tt><br>
<tt>> This mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended <br>
> solely for the use of the addressee(s). If you are not the intended <br>
> recipient, please notify the sender by e-mail and delete the <br>
> original message. LEOS has taken every reasonable precaution to <br>
> remove any viruses however you should also carry out your own virus <br>
> checks before opening the e-mail or attachment. </tt><br>
<tt>>  </tt><br>
<tt>>  </tt></body></html>