Silverfrost Forums

Welcome to our forums

MATLAB 7.5.0 (R2007b)

7 Nov 2007 8:17 #2409

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?

8 Nov 2007 7:50 #2411

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.

18 Nov 2007 10:22 #2449

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: https://forums.silverfrost.com/Forum/Topic/151 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

29 May 2014 8:43 #14128

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

29 May 2014 8:36 #14130

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 https://forums.silverfrost.com/Forum/Topic/151, 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.

30 May 2014 2:15 #14132

Hi mecej4, Thanks for replying. Can you provide us with the command that you used. Would be really grateful.

30 May 2014 3:44 #14133

To build the example included in [here]('http://www.silverfrost.com/public_downloads/MatLab.zip), 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)

2 Jun 2014 1:32 #14138

Sorry if its a stupid question but how do you set MATDIR to the path root of Matlab? I tried typing in set MATDIR in the command window of FTN95, but it says command set is not valid .

By the way, I'm using FTN95 Express and my Matlab is found in C:\Program Files\MATLAB\R2012a.

2 Jun 2014 3:33 #14139

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?

2 Jun 2014 3:55 #14140

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

2 Jun 2014 8:02 #14141

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.

2 Jun 2014 9:09 #14142

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.

***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?

2 Jun 2014 11:46 #14143

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.

3 Jun 2014 12:46 #14144

Oh ok. Thanks anyhow.

Please login to reply.