[help] the mean program in statitistical analysis
febty febriani
febty82 at gmail.com
Tue May 5 01:35:38 CDT 2009
hello everyone:
I am running the mean program with using octave in shell program. I met
error, but I don't know what its problem is.
I have the 36000 lines of data ASCII. I did the mean program for each of 10
lines data, so I should have 3600 lines in output files. But, actually, my
output file is just 1020 lines.
in terminal this is its error:
error: fprintf: invalid stream number = -1
error: evaluating for command near line 3, column 1
error: Too many open files
below is my complete program:
#!/bin/bash
for year in 2008
do
for month in 08
do
for day in 26
do
for hour in 01
do
for min in 00
do
for sec in 00
do
octave -q <<EOF
fid=fopen("${year}${month}${day}${hour}${min}${sec}.dat","r");
x=fscanf(fid,"%lf", [8 36000]);
for i=0:36000
x1=x(1,i*10+1:i*10+10);
x2=x(2,i*10+1:i*10+10);
x3=x(3,i*10+1:i*10+10);
x4=x(4,i*10+1:i*10+10);
x5=x(5,i*10+1:i*10+10);
x6=x(6,i*10+1:i*10+10);
x7=x(7,i*10+1:i*10+10);
x8=x(8,i*10+1:i*10+10);
x9=mean(x1);
x10=mean(x2);
x11=mean(x3);
x12=mean(x4);
x13=mean(x5);
x14=mean(x6);
x15=mean(x7);
x16=mean(x8);
fh2=fopen("${year}${month}${day}${hour}${min}${sec}.1Hz.dat","a+");
fprintf(fh2,'%f',x9);
fprintf(fh2,'%f',x10);
fprintf(fh2,'%f',x11);
fprintf(fh2,'%f',x12);
fprintf(fh2,'%f',x13);
fprintf(fh2,'%f',x14);
fprintf(fh2,'%f',x15);
fprintf(fh2,'%f\n',x16);
clear x8;
clear x9;
clear x10;
clear x11;
clear x12;
clear x13;
clear x14;
endfor
EOF
done
done
done
done
done
done
Are there any ideas for my problem?
Thanks very much in advance.
regards,
febty
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/help-octave/attachments/20090505/19d1930b/attachment.html
More information about the Help-octave
mailing list