Source: http://www.simwe.com/cgi-bin/ut/topic_show.cgi? id = 16634 & h = 1 & bpg = 1 & agn = -1
# 1. Installation Software Version: Compaq Visual Fortran (hereinafter referred to as CVF) 6.5 MATLAB 6.1 Installation Path: CVF: C: / Program Files / Microsoft Visual Studio Matlab: D: / Matlab # 2. Configure MEX to run down the MATLAB running command MEX - Setup, then select the CVF compiler # 3 as promp. Configure the compilation environment There are two options (1) MATLAB compile (assuming the MATLAB installation directory is% matLab%) 1. Open% matLab% / bin / win32 / mexopts / df60ngmatopts. BAT will change the set df_root =% df_root% in the 13 line to set df_root = C: / Program Files / Microsoft Visual Studio (CVF installation directory) 2. Change the MATLAB's work directory to your FortRAN source code stored by directory 3. Running MEX -F DF60Engmatopts.bat Exsample.For under Matlab (assuming the source file for an action on the MATLAB engine) (2) CVF compiles 1. New items 2. Include in Tools-> Directory And lib directory Remember to include the following directory include-> C: / Program Files / Microsoft Visual Studio / DF98 / Include Include-> C: / Program Files / Microsoft Visual Studio / DF98 / IMSL / INCLUDE INCLUDE-> D: / MATLAB / Extern / include lib-> d: / matlab / extern / lib / win32 lib-> d: / matlab / extern / lib / win32 / digital / df60 lib-> C: / Program Files / Microsoft Visual Studio / DF98 / IMSL / Lib lib-> C: / Program Files / Microsoft Visual Studio / DF98 / LIB 3. In Project-> Setting-> Link-> Object / Library Modules Add libmx.lib libmat. Lib Libeng.lib >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>>>>
1. The error that cannot be locked the program input point is incorrect. Because I use a routine that comes with MATLAB, this error is definitely a problem with your own system. I don't know if someone else has been encountered. Ask here, there is no result. I used "Unable to locate the program input point" to search on "Baidu". I found that when I was playing a game, I also encountered this error. The solution is to add the DLL file name mentioned before _, such as Libeng.dll changed to _Libeng.dll, and the Libeng.dll, libmx.dll, libeng.dll, libmx.dll, libut.dll in C: / WinNT / System 32 was changed, and then compiled and running. 2. What I want to do is to solve a binary three equation group to give a partial coordinate corresponding to the overall coordinates of eight nodes by using symbol operations in MATLAB. Mainly based on the fengdemo.f in matlab, it is also very simple, some small places should pay attention. When I started, I was compiled, I would give up, because Solve in Symbolic Math Toolbox is used to not support. Occasionally see the source program of FengDemo.f, and entering the single quotes (') in Matlab when using Engevalstring, it is expressed in 2 single quotes (' '), and it is wrong here. . Calculation results in matlab: 0.99433792247939 0.92631964939 0.92631964961160 Fortran Called results: 0.994337897515527 0.926319366356284 Different, double precision 3.
My source! Xshhn 2004.6.22 Program Main Double Precision ElementCod (16), Inquirecod (2), Localcod (2) Data ElementCod / -6.75000E 00, -6.75000E 00, -6.2500, -6.25000E 00 & & --6.75000e 00, -6.50000E 00, -6.50000E 00, & & 1.00000E 01, 9.50000E 00, 9.50000E 00, 1.00000E 01, & & 9.75000E 00, 9.50000E 00, 9.75000E 00, 1.00000E 01 /! A set of eight node unit node coordinate data inquirecod / -6.3, 9.55 /! Data local coordinate Data localcod / 2 * 0 /! query to the local coordinate unit call InquireLocalCod (ElementCod, InquireCod, LocalCod) write (*, *) LocalCod end! MATLAB query local coordinate call subroutine subroutine InquireLocalCod (ElementCod, InquireCod, LocalCod) double precision ElementCod (16 ), InquireCod (2), LocalCod (2) integer engOpen, engGetVariable, mxCreateDoubleMatrix integer engPutVariable, engEvalString, engClose integer mxGetPr integer ep, EC, IC, LC integer status write (*, *) ElementCod, InquireCod, LocalCod ep = engOpen ( 'Matlab')! Open Matlab Engine IF (EP.EQ.0) Then Write (6, *) 'Can''t Start Matlab Engine' Stop Endif EC = MXcreatedoublemtrix (1,16,0)! Establish MXAR ray call mxCopyReal8ToPtr (ElementCod, mxGetPr (EC), 16) IC = mxCreateDoubleMatrix (1,2,0) call mxCopyReal8ToPtr (InquireCod, mxGetPr (IC), 2) status = engPutVariable (ep, 'EC', EC)! The mxArray Feed MATLAB IF (Status.NE.0) THEN WRITE (6, *) 'ENGPUTVARIABLE FAILED1' Stop Endif Status = ENGPUTVARIABLE (EP, 'IC', IC)! Feed MxArray into MATLAB IF (status.ne.0) The Write (6, *) 'ENGPUTVARIABLE FAILED2' Stop Endififf (ENGEVALSTRING (EP, 'SYMS RS;') .ne. 0) Then! Here to call Symbolic Math Toolbox Write (6, *) 'Engevalstring Failed3 'Stop Endif! The following starts to enter the shape function such as 8 nodes in MATLAB,
Note "'" "" "to"' '"MMM = ENGEVALSTRING (EP,' N1 = SYM ('' (1-R) * (1-S) * (- RS-1) / 4 '' ) ') MMM = ENGEVALSTRING (EP,' N2 = SYM ('' '(1 R) * (1-S) * (RS-1) / 4' ')') mmm = ENGEVALSTRING (EP, 'N3 = SYM ('' (1 r) * (1 S) * (R S-1) / 4 '') ') MMM = ENGEVALSTRING (EP,' N4 = SYM ('' (1-r) * (1 S) * (- R S-1) / 4 '') ') MMM = ENGEVALSTRING (EP,' N5 = SYM ('' (1-R ^ 2) * (1-S) / 2 '') ') MMM = ENGEVALSTRING (EP,' N6 = SYM ('') * (1-S ^ 2) / 2 '') MMM = ENGEVALSTRING (EP, 'N7 = SYM (' '(1) -r ^ 2) * (1 S) / 2 '') ') mmm = ENGEVALSTRING (EP,' N8 = SYM ('' (1-r) * (1 S ^ 2) / 2 '') ' ) Mmm = eNgevalstring (EP, 'x = 0') mmm = ENGEVALSTRING (EP, 'Y = 0') mmm = ENGEVALSTRING (EP, 'X = x n1 * EC (1) N2 * EC (2) N3 * EC (3) N4 * EC (4) ') mmm = ENGEVALSTRING (EP,' X = x N5 * EC (5) N6 * EC (6) N7 * EC (7) N8 * EC (8) ') MMM = ENGEVALSTRING (EP,' Y = Y N1 * EC (9) N2 * EC (10) N3 * EC (11) N4 * EC (12) ') mmm = ENGEVALSTRING (EP , 'y = y N5 * EC (13) N6 * EC (14) N7 * EC (15) N8 * EC (16)') mmm = ENGEVALSTRING (EP, 'X = X-IC (1) ') Mmm = ENGEVALSTRING (EP,' Y = Y-IC (2) ') MMM = ENGEVALSTRING (EP,' [R, S] = SOLVE (X, Y) ')! Here is the most critical, that is, use SOLVE Solutions, MMM = ENGEVALSTRING (EP, 'LC = [EVAL (R (1)) EVAL (S (1))]') LC = Enggetvar Iable (EP, 'LC') Call MxcopyPTRTOREAL8 (MxgetPR (LC), Localcod, 2) Write (*, *) Localcod! Look at Call MXDESTROYARRAY (EC)! Recycle memory Call MXDESTROYARRAY (IC) Call MXDESTROYARRAY (LC) Status =