|
请教调用FORTRAN程序问题
楼上你好!刚刚因为论文需要计算接口,一直没有成功。现在向您请教。我是用MATLAB R2007a 调用v fortran6.5程序,按照书上写小的程序试验,总是出现这样的错误
mex fact.f90
Error fact.f90: 3 syntax error; found `mexfunction' expecting `;'
Error fact.f90: 4 extraneous old-style parameter list
Error fact.f90: 4 syntax error; found `integer' expecting `;'
Error fact.f90: 4 syntax error; found `plhs' expecting `;'
Error fact.f90: 4 syntax error; found `*' expecting `)'
Error fact.f90: 4 skipping `*'
Error fact.f90: 4 syntax error; found `*' expecting `)'
Error fact.f90: 4 skipping `*'
Error fact.f90: 5 syntax error; found `integer' expecting `;'
Error fact.f90: 5 syntax error; found `mxgetpr' expecting `;'
Error fact.f90: 6 syntax error; found `integer' expecting `;'
Error fact.f90: 6 syntax error; found `y_pr' expecting `;'
Error fact.f90: 7 syntax error; found `integer' expecting `;'
Error fact.f90: 7 syntax error; found `nlhs' expecting `;'
Error fact.f90: 8 syntax error; found `integer' expecting `;'
Error fact.f90: 8 syntax error; found `i' expecting `;'
Error fact.f90: 9 syntax error; found `real' expecting `;'
Error fact.f90: 9 syntax error; found `*' expecting `;'
Error fact.f90: 9 missing identifier
Error fact.f90: 9 syntax error; found `8' expecting `;'
Error fact.f90: 9 too many errors
C:\PROGRA~1\MATLAB\R2007A\BIN\MEX.PL: Error: Compile of 'fact.f90' failed.
??? Error using ==> mex at 206
Unable to complete successfully.
我用的是matlab自带的编译器,编译C例子程序已经成功,就是fortran总是类似错误。
源程序是:
subroutine mexfunction(nlhs,plhs,nrhs,prhs)
integer plhs(*),prhs(*)
integer mxgetpr,mxcreatedoublematrix
integer y_pr
integer nlhs,nrhs
integer i
real*8 x,y,mxgetscalar
x=mxgetscalar(prhs(1))
prhs(1)=mxcreatedoublematrix(1,1,0)
y_pr=mxgetpr(plhs(1))
y=1.0
do i=x,1,-1
y=y*i
end do
call mxcopyreal8toptr(y,y_pr,1)
return
end
望不吝赐教 |
|