请教调用FORTRAN程序问题
楼上你好!刚刚因为论文需要计算接口,一直没有成功。现在向您请教。我是用MATLAB R2007a 调用v fortran6.5程序,按照书上写小的程序试验,总是出现这样的错误mex fact.f90
Error fact.f90: 3syntax error; found `mexfunction' expecting `;'
Error fact.f90: 4extraneous old-style parameter list
Error fact.f90: 4syntax error; found `integer' expecting `;'
Error fact.f90: 4syntax error; found `plhs' expecting `;'
Error fact.f90: 4syntax error; found `*' expecting `)'
Error fact.f90: 4skipping `*'
Error fact.f90: 4syntax error; found `*' expecting `)'
Error fact.f90: 4skipping `*'
Error fact.f90: 5syntax error; found `integer' expecting `;'
Error fact.f90: 5syntax error; found `mxgetpr' expecting `;'
Error fact.f90: 6syntax error; found `integer' expecting `;'
Error fact.f90: 6syntax error; found `y_pr' expecting `;'
Error fact.f90: 7syntax error; found `integer' expecting `;'
Error fact.f90: 7syntax error; found `nlhs' expecting `;'
Error fact.f90: 8syntax error; found `integer' expecting `;'
Error fact.f90: 8syntax error; found `i' expecting `;'
Error fact.f90: 9syntax error; found `real' expecting `;'
Error fact.f90: 9syntax error; found `*' expecting `;'
Error fact.f90: 9missing identifier
Error fact.f90: 9syntax error; found `8' expecting `;'
Error fact.f90: 9too 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
望不吝赐教 受益非浅!!非常感谢!!!!! 谢谢楼主了 很好,很有用 很好很好很好 好了,太好了,正在学习中 O(∩_∩)O~ 谢谢lz分享啦{:{23}:} 很全面 很直观 谢谢楼主 很好的总结。。。 学习学习 非常感谢 很实用,很有帮助 好东西,谢谢了~ 感谢楼主分享,收藏了
页:
1
[2]