Hi,everyone.
I recently learn to use RNT matlab toolbox released by E. Di Lorenzo (Thanks for his excellent job).I find it really wonderful.
However,when I mex the Mex-files,a warning occurs,saying:
rnt_compile
rnt_fill3ab_mex.F(371) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
rnt_fillab_mex.F(350) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
rnt_fill_mex.F(345) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
rnt_fill_time_mex.F(323) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
rnt_oa2d_mex.F(383) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
rnt_oa2d_tile_mex.F(382) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
f90: Warning: Bad # preprocessor line
rnt_oa3d_mex.F(412) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
rnt_oa3d_v2_mex.F(554) : Warning: In the call to INVERSE, actual argument #5 does not match the type and kind of the corresponding dummy argument.
call inverse(Gp,c,c,A,issing) ! compute A=inv(Gp)
----------------------------^
I only change the variable "issing" type from integer to real, no complaint now. I just wonder is this right,and is there only this I need to modify? Now,
it is OK?
I am using WindowsXP system.
I downloaded the toolbox and all the files at this page :http://www.o3d.org/RNT/
are these file still all right ?
Thanks for any advice.
RNT toolbox
Re: RNT toolbox
You'd better use the RNT in the Linux OS. And if you use RNT in the 32bit systerm, you need to recompile the mex files as the complie.txt said in the RNT website. By the way, RNT is really a good tool for ROMS beginners. Good luck.
leon
leon
Re: RNT toolbox
Hi,thanks for your advice.I use win32,and I always encounter this error during running.
http://photo.xiaonei.com/getphoto.do?id ... 1793430397
mainly says forrtl:severe (38):error during write,unit -1,file CONOUT$
rnt_oa2d.mex.dll(etc) unknown unknown
what is that problem? How can I fix it ?
Or Can I use RNT under Cygwin?
Thanks
http://photo.xiaonei.com/getphoto.do?id ... 1793430397
mainly says forrtl:severe (38):error during write,unit -1,file CONOUT$
rnt_oa2d.mex.dll(etc) unknown unknown
what is that problem? How can I fix it ?
Or Can I use RNT under Cygwin?
Thanks
Re: RNT toolbox
I change from Winxp to Ubuntu. But I failed again to recompile the mex-files.I followed the complie.txt said in the RNT website,changing integer*8 to integer since my 32bit.
Here is the error message:
rnt_compile
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2sigma_mex.F:57
call xhslice(%val(pr_fout),%val(pr_zn),%val(pr_sn),%val(pr_finp),
1
In file rnt_2sigma_mex.F:66
subroutine xhslice (f2d,depths,z,f3d,im,jm,km,vintrp,iz)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mex.F:57
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mex.F:74
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mex_linear.F:57
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mex_linear.F:74
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mexV2.F:61
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mexV2.F:79
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1,vintrp)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2z_mex.F:63
call xhslice(%val(pr_fout),%val(pr_zn),%val(pr_sn),%val(pr_finp),
1
In file rnt_2z_mex.F:72
subroutine xhslice (f2d,depths,z,f3d,im,jm,km,vintrp,iz)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2z_mex_linux.F:57
call xhslice(%val(pr_fout),%val(pr_zn),%val(pr_sn),%val(pr_finp),
1
In file rnt_2z_mex_linux.F:66
subroutine xhslice (f2d,depths,z,f3d,im,jm,km,vintrp,iz)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fill3ab_mex.F:45
call oa_ex(%val(x), %val(y),%val(z),%val(datain),
1
In file rnt_fill3ab_mex.F:55
subroutine oa_ex(x,y,z,datain,xhat,yhat,zhat,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fillab_mex.F:41
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_fillab_mex.F:51
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fill_mex.F:39
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_fill_mex.F:49
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,errout)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fill_time_mex.F:41
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_fill_time_mex.F:51
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_hindicesTRI_mex.F:71
call hindices(%val(Ipos),%val(Jpos),%val(Xpos),%val(Ypos),
1
In file rnt_hindicesTRI_mex.F:78
subroutine hindices (Ipos,Jpos,Xpos,Ypos,Xgrd,Ygrd,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_oa2d_mex.F:49
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_oa2d_mex.F:60
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_oa2d_tile_mex.F:87
xs(ii)= x( pmap(i,ii) )
1
Error: Array index at (1) must be of INTEGER type
mex: compile of ' "rnt_oa2d_tile_mex.F"' failed.
??? Error using ==> mex at 207
Unable to complete successfully.
Error in ==> rnt_compile at 14
mex rnt_oa2d_tile_mex.F
How can I escape from this ?
Here is the error message:
rnt_compile
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2sigma_mex.F:57
call xhslice(%val(pr_fout),%val(pr_zn),%val(pr_sn),%val(pr_finp),
1
In file rnt_2sigma_mex.F:66
subroutine xhslice (f2d,depths,z,f3d,im,jm,km,vintrp,iz)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mex.F:57
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mex.F:74
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mex_linear.F:57
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mex_linear.F:74
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2s_mexV2.F:61
call vertinterp(%val(pr_finp),%val(pr_sn),%val(pr_zn),
1
In file rnt_2s_mexV2.F:79
subroutine vertinterp(finp1,s1,z1,im,jm,km,lm,fout1,vintrp)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2z_mex.F:63
call xhslice(%val(pr_fout),%val(pr_zn),%val(pr_sn),%val(pr_finp),
1
In file rnt_2z_mex.F:72
subroutine xhslice (f2d,depths,z,f3d,im,jm,km,vintrp,iz)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_2z_mex_linux.F:57
call xhslice(%val(pr_fout),%val(pr_zn),%val(pr_sn),%val(pr_finp),
1
In file rnt_2z_mex_linux.F:66
subroutine xhslice (f2d,depths,z,f3d,im,jm,km,vintrp,iz)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fill3ab_mex.F:45
call oa_ex(%val(x), %val(y),%val(z),%val(datain),
1
In file rnt_fill3ab_mex.F:55
subroutine oa_ex(x,y,z,datain,xhat,yhat,zhat,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fillab_mex.F:41
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_fillab_mex.F:51
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fill_mex.F:39
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_fill_mex.F:49
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,errout)
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_fill_time_mex.F:41
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_fill_time_mex.F:51
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_hindicesTRI_mex.F:71
call hindices(%val(Ipos),%val(Jpos),%val(Xpos),%val(Ypos),
1
In file rnt_hindicesTRI_mex.F:78
subroutine hindices (Ipos,Jpos,Xpos,Ypos,Xgrd,Ygrd,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_oa2d_mex.F:49
call oa_ex(%val(x), %val(y),%val(datain),
1
In file rnt_oa2d_mex.F:60
subroutine oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
2
Warning (155): Inconsistent types (INTEGER(4)/REAL(8)) in actual argument lists at (1) and (2)
Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
with mex is "4.0.0". The latest version tested for use with mex is "4.2.0".
To download a different version of gcc, visit http://gcc.gnu.org
In file rnt_oa2d_tile_mex.F:87
xs(ii)= x( pmap(i,ii) )
1
Error: Array index at (1) must be of INTEGER type
mex: compile of ' "rnt_oa2d_tile_mex.F"' failed.
??? Error using ==> mex at 207
Unable to complete successfully.
Error in ==> rnt_compile at 14
mex rnt_oa2d_tile_mex.F
How can I escape from this ?
RNT toolbox only run on MATLAB higher than 2007a?
does the RNT_tools(http://www.o3d.org/RNT/) only run on MATLAB higher than 2007a?
i encountered many problems when compile and run on MATLAB (R14)2004
I learn from this forum that RNT is highly OS and ARCH dependent.So someone use this TOOL please show me the detailed OS and ARCH requirement.I really need some guide! Thanks for any help.
i encountered many problems when compile and run on MATLAB (R14)2004
I learn from this forum that RNT is highly OS and ARCH dependent.So someone use this TOOL please show me the detailed OS and ARCH requirement.I really need some guide! Thanks for any help.
Re: RNT toolbox
I have the same problem as "forrtl:severe (38):error during write,unit -1,file CONOUT$" in windows system when running "rnt_oa2d_mex.mexw32". But strangely some functions like "rnt_hindicesTRI_mex.mexw32, rnt_fill_mex.mexw32" are workable. And I also failed in compiling the *.f files in Ubuntu system. It looks like RNT is indeed highly OS and ARCH dependent.
So I tried to modify the file "rnt_oa2d_mex.f" to a program, not a function, by using files to pass the parameters to matlab.
In "rnt_oa2d_mex.f", replace the mexfunction function with
program MAIN
implicit none
real(8), dimension(:), allocatable :: x,y,xhat,yhat,dataout
real(8), dimension(:), allocatable :: errout,datain
real(8), dimension(:,:), allocatable :: pmap
real(8) :: a,b
integer :: PtIn,PtOut,PtIns
open(10,FILE = 'PtIn.tmp',status = 'old')
read(10,*) PtIn
close(10)
open(10,FILE = 'PtOut.tmp',status = 'old')
read(10,*) PtOut
close(10)
open(10,FILE = 'PtIns.tmp',status = 'old')
read(10,*) PtIns
close(10)
open(10,FILE = 'a.tmp',status = 'old')
read(10,*) a
close(10)
open(10,FILE = 'b.tmp',status = 'old')
read(10,*) b
close(10)
ALLOCATE(x(PtIn),y(PtIn),xhat(PtOut),yhat(PtOut),dataout(PtOut))
ALLOCATE(errout(PtOut),datain(PtIn))
ALLOCATE(pmap(PtOut,PtIns))
open(10,FILE = 'lonr.tmp',status = 'old')
read(10,*) x
close(10)
open(10,FILE = 'latr.tmp',status = 'old')
read(10,*) y
close(10)
open(10,FILE = 't1.tmp',status = 'old')
read(10,*) datain
close(10)
open(10,FILE = 'lon.tmp',status = 'old')
read(10,*) xhat
close(10)
open(10,FILE = 'lat.tmp',status = 'old')
read(10,*) yhat
close(10)
open(10,FILE = 'pmap.tmp',status = 'old')
read(10,*) pmap
close(10)
call oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
c errout,a,b,PtIns,pmap)
open(10,FILE = 't2.tmp',status = 'NEW')
write(10,'(E19.12)') dataout
close(10)
open(10,FILE = 't2err.tmp',status = 'NEW')
write(10,'(E19.12)') errout
close(10)
DEALLOCATE(x,y,xhat,yhat,dataout,errout,datain,pmap)
end program MAIN
and write a matlab function rnt_oa2d_mex_dos as the interface:
function [t2,t2err]=rnt_oa2d_mex_dos(lonr,latr,t1,lon,lat,pmap,a,b);
PtIn = size(lonr);
[PtOut, PtIns] = size(pmap);
fid = fopen('PtIn.tmp','w');
fprintf(fid,'%10d',PtIn);
fclose(fid);
fid = fopen('PtOut.tmp','w');
fprintf(fid,'%10d',PtOut);
fclose(fid);
fid = fopen('PtIns.tmp','w');
fprintf(fid,'%10d',PtIns);
fclose(fid);
fid = fopen('a.tmp','w');
fprintf(fid,'%16.12f',a);
fclose(fid);
fid = fopen('b.tmp','w');
fprintf(fid,'%16.12f',b);
fclose(fid);
fid = fopen('lonr.tmp','w');
fprintf(fid,'%19.12e \n',lonr);
fclose(fid);
fid = fopen('latr.tmp','w');
fprintf(fid,'%19.12e \n',latr);
fclose(fid);
fid = fopen('t1.tmp','w');
fprintf(fid,'%19.12e \n',t1);
fclose(fid);
fid = fopen('lon.tmp','w');
fprintf(fid,'%19.12e \n',lon);
fclose(fid);
fid = fopen('lat.tmp','w');
fprintf(fid,'%19.12e \n',lat);
fclose(fid);
fid = fopen('pmap.tmp','w');
fprintf(fid,'%19.12e \n',pmap);
fclose(fid);
dos('rnt_oa2d_mex.exe');
t2 = load('t2.tmp');
t2err = load('t2err.tmp');
delete('PtIn.tmp','PtOut.tmp','PtIns.tmp','a.tmp','b.tmp');
delete('pmap.tmp','lonr.tmp','latr.tmp','t1.tmp','lon.tmp','lat.tmp');
delete('t2.tmp','t2err.tmp');
end
This is workable for windows. It is wasting of time to read and write variables to disk. But this is the only way I can solve the problem.
So I tried to modify the file "rnt_oa2d_mex.f" to a program, not a function, by using files to pass the parameters to matlab.
In "rnt_oa2d_mex.f", replace the mexfunction function with
program MAIN
implicit none
real(8), dimension(:), allocatable :: x,y,xhat,yhat,dataout
real(8), dimension(:), allocatable :: errout,datain
real(8), dimension(:,:), allocatable :: pmap
real(8) :: a,b
integer :: PtIn,PtOut,PtIns
open(10,FILE = 'PtIn.tmp',status = 'old')
read(10,*) PtIn
close(10)
open(10,FILE = 'PtOut.tmp',status = 'old')
read(10,*) PtOut
close(10)
open(10,FILE = 'PtIns.tmp',status = 'old')
read(10,*) PtIns
close(10)
open(10,FILE = 'a.tmp',status = 'old')
read(10,*) a
close(10)
open(10,FILE = 'b.tmp',status = 'old')
read(10,*) b
close(10)
ALLOCATE(x(PtIn),y(PtIn),xhat(PtOut),yhat(PtOut),dataout(PtOut))
ALLOCATE(errout(PtOut),datain(PtIn))
ALLOCATE(pmap(PtOut,PtIns))
open(10,FILE = 'lonr.tmp',status = 'old')
read(10,*) x
close(10)
open(10,FILE = 'latr.tmp',status = 'old')
read(10,*) y
close(10)
open(10,FILE = 't1.tmp',status = 'old')
read(10,*) datain
close(10)
open(10,FILE = 'lon.tmp',status = 'old')
read(10,*) xhat
close(10)
open(10,FILE = 'lat.tmp',status = 'old')
read(10,*) yhat
close(10)
open(10,FILE = 'pmap.tmp',status = 'old')
read(10,*) pmap
close(10)
call oa_ex(x,y,datain,xhat,yhat,PtIn,PtOut,dataout,
c errout,a,b,PtIns,pmap)
open(10,FILE = 't2.tmp',status = 'NEW')
write(10,'(E19.12)') dataout
close(10)
open(10,FILE = 't2err.tmp',status = 'NEW')
write(10,'(E19.12)') errout
close(10)
DEALLOCATE(x,y,xhat,yhat,dataout,errout,datain,pmap)
end program MAIN
and write a matlab function rnt_oa2d_mex_dos as the interface:
function [t2,t2err]=rnt_oa2d_mex_dos(lonr,latr,t1,lon,lat,pmap,a,b);
PtIn = size(lonr);
[PtOut, PtIns] = size(pmap);
fid = fopen('PtIn.tmp','w');
fprintf(fid,'%10d',PtIn);
fclose(fid);
fid = fopen('PtOut.tmp','w');
fprintf(fid,'%10d',PtOut);
fclose(fid);
fid = fopen('PtIns.tmp','w');
fprintf(fid,'%10d',PtIns);
fclose(fid);
fid = fopen('a.tmp','w');
fprintf(fid,'%16.12f',a);
fclose(fid);
fid = fopen('b.tmp','w');
fprintf(fid,'%16.12f',b);
fclose(fid);
fid = fopen('lonr.tmp','w');
fprintf(fid,'%19.12e \n',lonr);
fclose(fid);
fid = fopen('latr.tmp','w');
fprintf(fid,'%19.12e \n',latr);
fclose(fid);
fid = fopen('t1.tmp','w');
fprintf(fid,'%19.12e \n',t1);
fclose(fid);
fid = fopen('lon.tmp','w');
fprintf(fid,'%19.12e \n',lon);
fclose(fid);
fid = fopen('lat.tmp','w');
fprintf(fid,'%19.12e \n',lat);
fclose(fid);
fid = fopen('pmap.tmp','w');
fprintf(fid,'%19.12e \n',pmap);
fclose(fid);
dos('rnt_oa2d_mex.exe');
t2 = load('t2.tmp');
t2err = load('t2err.tmp');
delete('PtIn.tmp','PtOut.tmp','PtIns.tmp','a.tmp','b.tmp');
delete('pmap.tmp','lonr.tmp','latr.tmp','t1.tmp','lon.tmp','lat.tmp');
delete('t2.tmp','t2err.tmp');
end
This is workable for windows. It is wasting of time to read and write variables to disk. But this is the only way I can solve the problem.
Re: RNT toolbox
I found that if you comment line 77,78 and 82 with "print *," as prefixes in file "rnt_oa2d_mex.f", no error appear in windows system.