[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
octave error
From: |
John W. Eaton |
Subject: |
octave error |
Date: |
Fri, 7 Aug 2009 13:55:21 -0400 |
On 3-Aug-2009, Nuncio M wrote:
| Hi octavians,
| While compiling the script I got the following error
|
| error: octave_base_value::array_value(): wrong type argument `complex
| matrix'
| error: evaluating if command near line 29, column 2
| error: evaluating for command near line 8, column 2
| error: near line 57 of file `/home/nuncio/data/nodc/osd/file.m'
|
| following is the script
|
| addpath("/home/nuncio/matandoct/oceans")
| addpath("/home/nuncio/matandoct/seawater_ver3_2")
|
| ext='.txt';
| prefix1='file_';
| prefix2='file_splint_';
| prefix3='file_brfr_';
| for i=2410:2414
| l=i;
| mid=int2str(l);
| infilename=[prefix1,mid,ext];
| oufilename1=[prefix2,mid,ext];
| oufilename2=[prefix3,mid,ext];
| PR=1000.0;
| xx=load(infilename);
| mnth=xx(:,1);
| dday=xx(:,2);
| yyear=xx(:,3);
| llon=xx(:,4);
| llat=xx(:,5);
| lev=xx(:,6);
| tem=xx(:,7);
| sal=xx(:,8);
| disp(infilename);
| lev_n=[0:50]*2+1;
| sz=length(lev_n);
| sz1=length(lev);
| disp(lev(sz1))
| if ((length(lev) >= 5) && (lev(sz1) > 80.0))
| disp(infilename);
| tem_int=interp1(lev,tem,lev_n,'spline','extrap');
| sal_int=interp1(lev,sal,lev_n,'spline','extrap');
| S=sal_int;
| T=tem_int;
| P=lev_n;
| bf=bvfreq(S,T,P);
| nsqd=bf.*bf;
| dens= sw_dens(S,T,P);
| pden=sw_pden(S,T,P,PR);
| % writing tem and salinity to file---------
| fid=fopen(oufilename1,"wt");
| fprintf(fid,'%5.1f %3.1f %3.1f %7.2f %7.2f\n',vertcat(yyear(1),\
| mnth(1),dday(1),llon(1),llat(1)))
| fprintf(fid,'%5.1f %9.3f %9.3f %10.3f \n',vertcat(lev_n,tem_int,\
| sal_int,dens));
| fclose(fid);
| % --------------------------------------
| % Writing brufre tofile
| fid=fopen(oufilename2,"wt");
| fprintf(fid,'%5.1f %3.1f %3.1f %7.2f %7.2f\n',vertcat(yyear(1),\
| mnth(1),dday(1),llon(1),llat(1)))
| fprintf(fid,'%5.1f %9.3f\n',\
| vertcat(lev_n(1:50),nsqd));
| fclose(fid)
| % --------------------------------------
| endif
| endfor
Is this script /home/nuncio/data/nodc/osd/file.m? Where is line 57?
Unless you omitted some lines, it is at the end of the script, which
makes no sense.
If you post a complete example, including the data files you are using
when you see the error, then someone might be able to help you.
Otherwise, I think you will have to debug this problem yourself.
jwe