View previous topic :: View next topic |
Author |
Message |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Wed Nov 07, 2007 9:17 am Post subject: MATLAB 7.5.0 (R2007b) |
|
|
Hello,
I have upgraded from MATLAB 6.5 to MATLAB 7.5 and get the following message when running mex -setup from the MATLAB command line:
Please choose your compiler for building external interface (MEX) files:
Not an ARRAY reference at D:\Programs\MATHWO~1\bin\/mexsetup.pm line 614.
??? Error using ==> mex at 208
Unable to complete successfully.
When I remove the files SF95opts.bat and SF95opts.stp from the above directory the mex execution is fine. It seems like the files with the compiler options needs an upgrade as well.
Do I need to change the above mentioned files? |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Thu Nov 08, 2007 8:50 am Post subject: |
|
|
I don't think that we can help you with this query unless and until we get a copy of this version of MATLAB.
Other MATLAB users may be able to help. |
|
Back to top |
|
 |
jjgermis
Joined: 21 Jun 2006 Posts: 404 Location: N�rnberg, Germany
|
Posted: Sun Nov 18, 2007 11:22 am Post subject: Compiler options |
|
|
Hi,
from the number of views it seems that there might be some interest to this topic. I still did not found a solution to my problem. Maybe someone else is in the same situation than I. Anyway here is what I have figured out:
A good starting point to use FTN95 with Matlab: http://forums.silverfrost.com/viewtopic.php?t=219
Read the following in the Matlab documentation: Building MEX-Files
Custom Building MEX-Files
Work through the following example in the Matlab documentation: Fortran MEX-Files
The Matlab documentation along with FTN95 example and Matlab Version 6.5 give some insight into what is happening.
When running mex -setup in Matlab Version 7.5 it seems that the perl script has some problems with the SF95opts.stp file. The latter contains compiler information and the default location of FTN95.exe. Basically what should happen by performing mex -setup is that the content of SF95opts.bat should be copied into the mexopts.bat in the Matlab ..\bin\win32\ directory.
I suppose that by doing this by hand should solve my problem
Jacques |
|
Back to top |
|
 |
Karthik23
Joined: 29 May 2014 Posts: 6
|
Posted: Thu May 29, 2014 9:43 am Post subject: Compiler Options |
|
|
Hi jjgermis,
I encountered the same problem during mex -setup. I'm using Matlab R2012a, Windows7 (64bit).
However, I do not have a mexopts.bat located in the mexopts folder. I also do not know which part of S95opts.bat to append into mexopts.bat.
Do you have any idea?
Karthik |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Thu May 29, 2014 9:36 pm Post subject: |
|
|
The Mex Perl scripts provided by Mathworks come prepared to work with only a small number of "approved" compilers. If you wish to use a different compiler, your chances of success are far better if you build the MEX files outside of Matlab (without using the Mex Perl script).
I downloaded the file mentioned in http://forums.silverfrost.com/viewtopic.php?t=219, and was able to build a MEX DLL at the command line using FTN95 7.0 and the command line script build.bat, and the DLL worked with Matlab 2007b correctly. |
|
Back to top |
|
 |
Karthik23
Joined: 29 May 2014 Posts: 6
|
Posted: Fri May 30, 2014 3:15 am Post subject: |
|
|
Hi mecej4, Thanks for replying. Can you provide us with the command that you used. Would be really grateful. |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Fri May 30, 2014 4:44 am Post subject: |
|
|
To build the example included in [url="http://www.silverfrost.com/public_downloads/MatLab.zip"]here[/url], set MATDIR to the path to the root directory of Matlab, then use the commands
ftn95 timestwo.f /DREAL
slink -dll -export:_MEXFUNCTION@16=MEXFUNCTION timestwo.obj %MATDIR%\bin\win32\libmx.dll %MATDIR%\bin\win32\libmex.dll
Run Matlab from the Silverfrost FTN95 command window, and test the DLL just produced using the command
a=timestwo(2.5) |
|
Back to top |
|
 |
Karthik23
Joined: 29 May 2014 Posts: 6
|
Posted: Mon Jun 02, 2014 2:32 am Post subject: |
|
|
Sorry if its a stupid question but how do you set MATDIR to the path root of Matlab? I tried typing in in the command window of FTN95, but it says Code: | command set is not valid | .
By the way, I'm using FTN95 Express and my Matlab is found in C:\Program Files\MATLAB\R2012a. |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Mon Jun 02, 2014 4:33 am Post subject: |
|
|
The command is "set matdir=C:\Program Files\MATLAB\R2012a" for your set up, but there is something wrong if you got the response "command set is not valid". Are you working in the command window (cmd.exe) configured for use with FTN95? |
|
Back to top |
|
 |
Karthik23
Joined: 29 May 2014 Posts: 6
|
Posted: Mon Jun 02, 2014 4:55 am Post subject: |
|
|
No. I wasn't using cmd.exe, instead I was using the command window of FTN95.
Currently, I have tried the command on cmd.exe, but it doesn't work also. I guess my cmd.exe is not configured for use with FTN95. How do I then configure it with FTN95 and how do i check if its configured?
Thanks |
|
Back to top |
|
 |
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 8210 Location: Salford, UK
|
Posted: Mon Jun 02, 2014 9:02 am Post subject: |
|
|
You can run FTN95 directly from a command prompt window provided that the compiler folder for FTN95 (normally C:\Program Files...\Silverfrost\FTN95) is on the PATH environment variable.
Just type "PATH" from a command prompt window to see if the Silverfrost folder is present in the list. |
|
Back to top |
|
 |
Karthik23
Joined: 29 May 2014 Posts: 6
|
Posted: Mon Jun 02, 2014 10:09 am Post subject: |
|
|
Thanks Paul. I managed to set it on my PATHVARIABLE and managed to compile timestwo.f into an object.
However, now command prompt could not open libmex.dll or libmx.dll during the linking step.
Code: | ***Could not open: c:\"program files"\matlab\r2012a\bin\win64\libmex.dll
^C |
Could this be due to the difference in the 32 and 64 bits used by mecej4? |
|
Back to top |
|
 |
mecej4
Joined: 31 Oct 2006 Posts: 1899
|
Posted: Mon Jun 02, 2014 12:46 pm Post subject: |
|
|
It is now evident that your installed Matlab is a 64-bit version. If so, you need a compiler capable of producing 64-bit DLLs. Silverfrost/Salford FTN95 is not such a compiler. |
|
Back to top |
|
 |
Karthik23
Joined: 29 May 2014 Posts: 6
|
Posted: Tue Jun 03, 2014 1:46 am Post subject: |
|
|
Oh ok. Thanks anyhow. |
|
Back to top |
|
 |
|