f



Compiling Mex file, MAC OSX 10.6, MATLAB R2010a

I am brand new to compiling and MATLAB + mex, but I can't get the example (http://www.mathworks.com/support/tech-notes/1600/1605.html#testing) to run.

I have gcc installed in /usr/bin/gcc and gfortran in /usr/local/bin/gfortran. I have Xcode 3 installed, though I don't know where that plays in, but I saw some controversy over Xcode 3 and Xcode 4, so just saying...

Here is my working directory:

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>> pwd
ans =
/Applications/MATLAB_R2010a.app/extern/examples/mex
>> ls
arrayProduct.c		mexeval.c		mexload.c
arraySize.c		mexeval.m		mexload.m
explore.c		mexevalstring.c		mexlock.c
explore.mexmaci64	mexfeval.c		mexlockf.F
explore.mexmaci64.csf	mexfeval.m		mexsettrapflag.c
mexatexit.c		mexfio64.c		yprime.c
mexatexit.cpp		mexfunction.c		yprime.m
mexcallmatlab.c		mexget.c		yprimef.F
mexcpp.cpp		mexgetarray.c		yprimefg.F

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
My commands have varied a bit from the example because I do not have yprime.f, but no matter what I try, I get the same error, for example:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

>> mex -v yprime.f
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
   FILE = /Users/cmscheip/.matlab/R2010a/mexopts.sh
----------------------------------------------------------------
->    MATLAB                = /Applications/MATLAB_R2010a.app
->    CC                    = gcc-4.0
->    CC flags:
         CFLAGS             = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6  -fexceptions
         CDEBUGFLAGS        = -g
         COPTIMFLAGS        = -O2 -DNDEBUG
         CLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    CXX                   = g++-4.0
->    CXX flags:
         CXXFLAGS           = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6
         CXXDEBUGFLAGS      = -g
         CXXOPTIMFLAGS      = -O2 -DNDEBUG
         CXXLIBS            = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    FC                    = gfortran
->    FC flags:
         FFLAGS             = -fexceptions -m64 -fbackslash
         FDEBUGFLAGS        = -g
         FOPTIMFLAGS        = -O
         FLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1/../../.. -lgfortran -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1 -lgfortranbegin
         arguments          =  -DMX_COMPAT_32
->    LD                    = gcc-4.0
->    Link flags:
         LDFLAGS            = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010a.app/extern/lib/maci64/fexport.map
         LDDEBUGFLAGS       = -g
         LDOPTIMFLAGS       = -O
         LDEXTENSION        = .mexmaci64
         arguments          = 
->    LDCXX                 = 
->    Link flags:
         LDCXXFLAGS         = 
         LDCXXDEBUGFLAGS    = 
         LDCXXOPTIMFLAGS    = 
         LDCXXEXTENSION     = 
         arguments          = 
----------------------------------------------------------------


    mex:  yprime.f  not a normal file or does not exist.

??? Error using ==> mex at 222
Unable to complete successfully.
 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Any ideas? I have changed /Users/cmscheip/.matlab/R2010a/mexopts.sh to reflect 10.6 not 10.6.
0
cmscheip (23)
6/23/2011 7:51:04 PM
comp.soft-sys.matlab 211266 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

4 Replies
890 Views

Similar Articles

[PageSpeed] 42

I think the issue is the case of the file extension.

yprimef.F exists, but yprimef.f does not.

Gadi
0
greinhorn (41)
6/24/2011 12:10:09 PM
Gadi Reinhorn <greinhorn@mathworks.com> wrote in message <4E047EA1.6030404@mathworks.com>...
> I think the issue is the case of the file extension.
> 
> yprimef.F exists, but yprimef.f does not.
> 
> Gadi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Gadi, good catch....but I have tried every yprime* file listed in the directory and get the same error every time. I've also tried arrayProduct.c and arraySize.c and get the same error.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

>> mex -v ypimef.F
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
   FILE = /Users/cmscheip/.matlab/R2010a/mexopts.sh
----------------------------------------------------------------
->    MATLAB                = /Applications/MATLAB_R2010a.app
->    CC                    = gcc-4.0
->    CC flags:
         CFLAGS             = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6  -fexceptions
         CDEBUGFLAGS        = -g
         COPTIMFLAGS        = -O2 -DNDEBUG
         CLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    CXX                   = g++-4.0
->    CXX flags:
         CXXFLAGS           = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6
         CXXDEBUGFLAGS      = -g
         CXXOPTIMFLAGS      = -O2 -DNDEBUG
         CXXLIBS            = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    FC                    = gfortran
->    FC flags:
         FFLAGS             = -fexceptions -m64 -fbackslash
         FDEBUGFLAGS        = -g
         FOPTIMFLAGS        = -O
         FLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1/../../.. -lgfortran -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1 -lgfortranbegin
         arguments          =  -DMX_COMPAT_32
->    LD                    = gcc-4.0
->    Link flags:
         LDFLAGS            = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010a.app/extern/lib/maci64/fexport.map
         LDDEBUGFLAGS       = -g
         LDOPTIMFLAGS       = -O
         LDEXTENSION        = .mexmaci64
         arguments          = 
->    LDCXX                 = 
->    Link flags:
         LDCXXFLAGS         = 
         LDCXXDEBUGFLAGS    = 
         LDCXXOPTIMFLAGS    = 
         LDCXXEXTENSION     = 
         arguments          = 
----------------------------------------------------------------


    mex:  ypimef.F  not a normal file or does not exist.

??? Error using ==> mex at 222
Unable to complete successfully.
 
>> 
0
cmscheip (23)
6/24/2011 1:54:04 PM

"Corey Scheip" <cmscheip@ncsu.edu> wrote in message 
news:iu24ts$5n$1@newscl01ah.mathworks.com...
> Gadi Reinhorn <greinhorn@mathworks.com> wrote in message 
> <4E047EA1.6030404@mathworks.com>...
>> I think the issue is the case of the file extension.
>>
>> yprimef.F exists, but yprimef.f does not.
>>
>> Gadi
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> Gadi, good catch....but I have tried every yprime* file listed in the 
> directory and get the same error every time. I've also tried 
> arrayProduct.c and arraySize.c and get the same error.
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>>> mex -v ypimef.F

I assume this typo is just in the version that you posted to CSSM, and that 
it still fails to work if you used the correct spelling of the name?

Try copying yprime.F to a temporary directory (TEMPDIR) to which you know 
you have write permissions. Do you still receive an error when you compile 
the version of the file in the temporary directory?

-- 
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on 
http://www.mathworks.com 

0
slord (13689)
6/24/2011 2:55:28 PM
Steve, thanks for the tip, here's where I am (and you're right it was a typo I posted earlier but didn't affect my error). I've copied the extern/examples/mex directory into a temporary directory that I have full rwx permissions to. Now I am getting a different error:

>> ls -l
total 0
drwxrwxrwx  29 cmscheip  staff  942 Jun 24 11:27 mex

>> cd mex
>> ls -l
total 296
-r--r--r--@ 1 cmscheip  staff   2353 Jun 24 11:26 arrayProduct.c
-r--r--r--@ 1 cmscheip  staff   2679 Jun 24 11:26 arraySize.c
-r--r--r--@ 1 cmscheip  staff  18089 Jun 24 11:26 explore.c
-r-xr-xr-x@ 1 cmscheip  staff  13792 Jun 24 11:26 explore.mexmaci64
-r--r--r--@ 1 cmscheip  staff    252 Jun 24 11:26 explore.mexmaci64.csf
-r--r--r--@ 1 cmscheip  staff   2264 Jun 24 11:26 mexatexit.c
-r--r--r--@ 1 cmscheip  staff   2191 Jun 24 11:26 mexatexit.cpp
-r--r--r--@ 1 cmscheip  staff   3005 Jun 24 11:26 mexcallmatlab.c
-r--r--r--@ 1 cmscheip  staff   2947 Jun 24 11:26 mexcpp.cpp
-r--r--r--@ 1 cmscheip  staff   1597 Jun 24 11:26 mexeval.c
-r--r--r--@ 1 cmscheip  staff    805 Jun 24 11:26 mexeval.m
-r--r--r--@ 1 cmscheip  staff    962 Jun 24 11:26 mexevalstring.c
-r--r--r--@ 1 cmscheip  staff   1002 Jun 24 11:26 mexfeval.c
-r--r--r--@ 1 cmscheip  staff    544 Jun 24 11:26 mexfeval.m
-r--r--r--@ 1 cmscheip  staff  13137 Jun 24 11:26 mexfio64.c
-r--r--r--@ 1 cmscheip  staff   1217 Jun 24 11:26 mexfunction.c
-r--r--r--@ 1 cmscheip  staff   2279 Jun 24 11:26 mexget.c
-r--r--r--@ 1 cmscheip  staff   2591 Jun 24 11:26 mexgetarray.c
-r--r--r--@ 1 cmscheip  staff   2834 Jun 24 11:26 mexload.c
-r--r--r--@ 1 cmscheip  staff    378 Jun 24 11:26 mexload.m
-r--r--r--@ 1 cmscheip  staff   1852 Jun 24 11:26 mexlock.c
-r--r--r--@ 1 cmscheip  staff   2637 Jun 24 11:26 mexlockf.F
-r--r--r--@ 1 cmscheip  staff   1950 Jun 24 11:26 mexsettrapflag.c
-r--r--r--@ 1 cmscheip  staff   2386 Jun 24 11:26 yprime.c
-r--r--r--@ 1 cmscheip  staff   1729 Jun 24 11:26 yprime.m
-r--r--r--@ 1 cmscheip  staff    554 Jun 24 11:26 yprimef.F
-r--r--r--@ 1 cmscheip  staff   2997 Jun 24 11:26 yprimefg.F

>> mex -v yprimef.F
-> mexopts.sh sourced from directory (DIR = $HOME/.matlab/$REL_VERSION)
   FILE = /Users/cmscheip/.matlab/R2010a/mexopts.sh
----------------------------------------------------------------
->    MATLAB                = /Applications/MATLAB_R2010a.app
->    CC                    = gcc-4.0
->    CC flags:
         CFLAGS             = -fno-common -no-cpp-precomp -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6  -fexceptions
         CDEBUGFLAGS        = -g
         COPTIMFLAGS        = -O2 -DNDEBUG
         CLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    CXX                   = g++-4.0
->    CXX flags:
         CXXFLAGS           = -fno-common -no-cpp-precomp -fexceptions -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6
         CXXDEBUGFLAGS      = -g
         CXXOPTIMFLAGS      = -O2 -DNDEBUG
         CXXLIBS            = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -lstdc++
         arguments          =  -DMX_COMPAT_32
->    FC                    = gfortran
->    FC flags:
         FFLAGS             = -fexceptions -m64 -fbackslash
         FDEBUGFLAGS        = -g
         FOPTIMFLAGS        = -O
         FLIBS              = -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1/../../.. -lgfortran -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1 -lgfortranbegin
         arguments          =  -DMX_COMPAT_32
->    LD                    = gcc-4.0
->    Link flags:
         LDFLAGS            = -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010a.app/extern/lib/maci64/fexport.map
         LDDEBUGFLAGS       = -g
         LDOPTIMFLAGS       = -O
         LDEXTENSION        = .mexmaci64
         arguments          = 
->    LDCXX                 = 
->    Link flags:
         LDCXXFLAGS         = 
         LDCXXDEBUGFLAGS    = 
         LDCXXOPTIMFLAGS    = 
         LDCXXEXTENSION     = 
         arguments          = 
----------------------------------------------------------------

-> gfortran -c  -I/Applications/MATLAB_R2010a.app/extern/include -I/Applications/MATLAB_R2010a.app/simulink/include -fexceptions -m64 -fbackslash  -DMX_COMPAT_32 -O  "yprimef.F"

-> gcc-4.0 -O -Wl,-twolevel_namespace -undefined error -arch x86_64 -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -bundle -Wl,-exported_symbols_list,/Applications/MATLAB_R2010a.app/extern/lib/maci64/fexport.map -o  "yprimef.mexmaci64"  yprimef.o  -L/Applications/MATLAB_R2010a.app/bin/maci64 -lmx -lmex -lmat -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1/../../.. -lgfortran -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin10.3.0/4.5.1 -lgfortranbegin

Undefined symbols:
  "_mexfunction_", referenced from:
     -exported_symbol[s_list] command line option
ld: symbol(s) not found
collect2: ld returned 1 exit status

    mex: link of ' "yprimef.mexmaci64"' failed.

??? Error using ==> mex at 222
Unable to complete successfully.
 
%%%%%%%%%%%%%%%%%%%%
I see the /mex folder has a explore.mexmaci64 file, but nowhere do I even see a yprimef.mexmaci64 file?
0
cmscheip (23)
6/24/2011 4:04:04 PM
Reply:

Similar Artilces:

Why can't Fortran-mex files be compiled on matlab V5.3 and run on matlab V6?
Hi, does anyone know why Fortran-mex files can't be compiled on matlab V5.3 and run on matlab V6? For example: if I compile the example-program (shipped with matlab) timestwo.f on matlab version 5.3 (R11) and try to run it on matlab version 6+ (R12 or R13), I get the error message: "Unable to load mex file: E:\timestwo.dll. The specified module could not be found. ??? Invalid MEX-file" Likewise if I compile it on matlab version 6.1 (R12), I get a similar error message if run on matlab version 5.3 (R11). However, if I run it on matlab version 6.5 it works OK. If I try the same experiment with the corresponding example file written in C, timestwo.c, I get no such problems. Why is that? Per A. Hi Per, usually MEX-files need to be compiled with the MATLAB version you want it later to run with. The reason is, that the code links against the current dynamic libraries (DLLs), which may change from version to version. You may have luck that it works (see your example of timestwo.f), but you should never rely on this. Titus "Per A. Brodtkorb" <Per.Brodtkorb@ffi.no> wrote in message news:eecb303.-1@webx.raydaftYaTP... > Hi, > > does anyone know why Fortran-mex files can't be compiled on matlab > V5.3 and run on matlab V6? > > For example: if I compile the example-program (shipped with matlab) > timestwo.f > on matlab version 5.3 (R11) and try to run > it on matlab version 6+ (R12 or R13), I ...

Mac 10.6.3 Matlab r2010
Installed okay - activated fine but when I start Matlab I get the StartMENU but don't get to the splash screen and then application closes. Suggestions - don't want to waste more time then I have already to resolve license protection issues from Mathworks - group license on university server. Think the app can't get to license?? Reinstalled - 32 bit javascript for this version ok - firewall ok port 443 yeah - waved chicken feathers and beads at it. "Ken " <ken.pence@yahoo.comremove.this> wrote in message news:ht10mo$onq$1@fred.mathworks.com... > Installed okay - activated fine but when I start Matlab I get the > StartMENU but don't get to the splash screen and then application closes. > Suggestions - don't want to waste more time then I have already to resolve > license protection issues from Mathworks - group license on university > server. Think the app can't get to license?? Reinstalled - 32 bit > javascript for this version ok - firewall ok port 443 yeah - waved chicken > feathers and beads at it. I suggest you contact your university's IT group and Technical Support so they can work with you to investigate why MATLAB doesn't start correctly on your machine and how to fix the problem. -- Steve Lord slord@mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks....

Incompatible of MAT file for Matlab 6.5.1 and Matlab 7.0
Hi! I have recently installed Matlab 7.0. I have save my simulation results in .MAT file. However, these MAT files can't be opened using Matlab 6.5.1. I encountered problem as follows: ??? Error using ==> load Unable to read MAT file D:\MATLAB7\work\results.mat File may be corrupt. How can I solve this problem? Thanks. Linda Please see here: <http://tx.technion.ac.il/~perryb/matlab7/mat7.pdf> In short, save again as: The new features and enhancements are described in the "Release notes" of Matlab. A new feature that causes incompatibility with previous versions of Matlab is the new encoding of MAT files. Matlab release 14 writes character and figure data to MAT-files using Unicode encoding by default. Unicode encoded MAT-files are not readable by earlier versions of Matlab. If you intend to load your MAT-files created with Matlab release 14, you must override the Unicode default during the save. You can override the default encoding by using the -v6 switch with save and hgsave: save filename -v6 hgsave filename -v6 Hope it helps Linda wrote: > > > Hi! > > I have recently installed Matlab 7.0. > I have save my simulation results in .MAT file. > However, these MAT files can't be opened using Matlab 6.5.1. > > I encountered problem as follows: > > ??? Error using ==> load > Unable to read MAT file D:\MATLAB7\work\results.mat > > File ma...

mex set up with Mac 10.7 (using matlab 2010a)
Hi, I was trying to install glpk, and I had the problem copied below. I saw similar problems on the forums, and tried to figure it out, but I couldn't. I have already did mex -setup and tried all the alternatives. They did not work. Any help will be appreciated, thank you. Firdevs GLPKMEX - A Matlab interface for GLPK. Script installer. Version 2.4 compatible with GLPK 4.20 (or higher) (C) 2001-2007, Nicolo' Giorgetti. Do you want to use graphic installer? Y/N [Y]: n GLPK path: /usr/local GLPK path... /usr/local GLPK include files...OK GLPK library file...OK /Applications/MATLAB_R2010a.app/bin/mex: line 306: gcc-4.2: command not found mex: glpkcc.cpp not a normal file or does not exist. ??? Error using ==> mex at 222 Unable to complete successfully. Error in ==> makeglpkmex at 111 eval(['mex ' cmd]); ...

Issues when using mex with 2011b in Mac OSX 10.6.8
Hi, I am having issues when attempting to compile the mex file in Mac (osx 10.6.8). I have downloaded Xcode 4.2 and have used the patch for 2011b (http://www.mathworks.com/support/solutions/en/data/1-FR6LXJ/). Which has gotten me beyond the initial error of: /Applications/MATLAB_R2011b.app/bin/mex: line 305: gcc-4.2: command not found However, now I have the new issue of: dijkstra_trust.c:4:17: error: mex.h: No such file or directory dijkstra_trust.c:7: error: expected declaration specifiers or '...' before 'mxArray' dijkstra_trust.c:7: error: expected ';', ',' or ')' before '*' token mex: compile of ' "dijkstra_trust.c"' failed. Error using mex (line 206) Unable to complete successfully. This is completely out of my level of expertise and have no idea what is going on. Any help would be greatly appreciated. Cheers, Michele ...

C++ Mex file crashes matlab on 64bit linux, but not 32 bit windows, but program runs fine outside Matlab
Hello, I have written a mex gateway function to a C++ class. If I compile this mex function on 32Bit windows using R2008a I have no problems. If I compile and run on Matlab R2011a running 64bit Scientific Linux (a version of Red Hat Enterprize Linux) matlab exits with a segfault when the mexfunction is called, although it appears to run about halfway through the program. The C++ class can be compiled and run (with a main function) outside of Matlab on both platforms with no errors. I am using Microsoft Visual C++ Express Edition on the windows machine, and gcc 4.4.5 on the Linux machine. Can anyone suggest what the cause of this might be and how I can I fix it? I am having a hard time debugging on Linux as I do not have access to a graphical debugger for use with matlab and am unfamiliar with gdb. This is compounded by the fact that the program compiles and runs fine when compiled as a standalone program. A zip file containing the code and data files necessary to reproduce the problem can be downloaded from http://www.see.ed.ac.uk/~s0237326/downloads/mexcrash.zip. This zip file contains the .m and .cpp source code, and a text file for testing (Temp.fem). The file fmehsersetup.m shows the commands I am using to compile. The file Test_mexfmesher.m runs the mexfunction with an appropriate input for testing. The mex gateway function is mexfmesher.cpp, it calls the fmesher class which is made up of the files in the fmesher directory. Below is a backtrace from the se...

Can I atomically include files to the ctf file of the Matlab compiler?
Hi, My problem: I've a function myHelperFcn.m which needs myData.mat and myImage.jpg at runtime. I can include the needed files with the -a option of the mcc command, like this: mcc -m myFcn.m –a myData.mat -a myImage.jpg But I'm searching for a mechanism like the function pragma (%#function myCallbackFcn) for non m-files, which atomically includes the needed files to the ctf file. thanks, Martin ...

Matlab automation server and Matlab Compiler Run Time
I did a simple excel macro which runs matlab functions sucessfully in a machine with Matlab installed. Now I want to run it in a computer without matlab, with "MATLAB Compiler Run Time" installed. I can add the Matlb automation server type file (mlapp.tlb) sucessfully, but when I try to run it, I get this error: "ActiveX component can't create object" In this line: Set matlab = New MLApp.MLApp Do you know what is missing? Thanks ...

Mex file crashes Matlab
Hello all, I created successfully a mex file. It is linked to an external dll and it worked fine (it returns correctly to matlab a vector). Recently I added an new function inside my c++ file which does not affect the result of the c++ function but is just used to improve some data manipulation. By the way, this function works quite well in a simple c++ file and I have already used many times in other c++ files (no-mex files). After added this function my matlab crashes and returns me this error: MATLAB crash file:C:\DOCUME~1\MILCEMEA~1.VAA\LOCALS~1\Temp\matlab_crash_dump.2996 ------------------------------------------------------------------------ Segmentation violation detected at Wed Jul 28 18:38:04 2010 ------------------------------------------------------------------------ Operating System: Microsoft Windows XP Window System: Version 5.1 (Build 2600: Service Pack 3) Processor ID: x86 Family 6 Model 7 Stepping 10, GenuineIntel Virtual Machine: Java 1.6.0_04-b12 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode Default Encoding: windows-1252 Fault Count: 1 Register State: EAX = ffff5df8 EBX = 00c2e01c ECX = ffffffff EDX = e06d7363 ESI = ffff5df4 EDI = 04f169ec EBP = 00c2e028 ESP = 00c2cf40 EIP = 04ec186e FLG = 00010286 Stack Trace: [0] qlDiscountFactors.mexw32:0x04ec186e(0x00c2e158 "x£", 0x00c2e0b8, 0x00c2e1fc, 0) [1] 0x00c2e20c(0x8b00032b, 0x04c483d8, 0x85e85d89,...

Call Matlab m-file from Matlab Scrip Node
My problem with matlab script node is related to calling function in matlab.&nbsp; I created an m-file function that takes an imput temperature (from DAQ) and defines a material property.&nbsp; My matlab script node doesn't seem to recognize my function.&nbsp; I have placed the function in the folder the vi is currently located, but it doesn't read it.&nbsp; How do I get matlab script node to read the functions I create in matlab? Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m) Let me clarify, &nbsp; I have pasted my matlab code into the matlab scrip node. &nbsp; In this code, I have called a subfunction that I have created. &nbsp; Example k(n)=k_c(T(n)) where k_c is a subfunction I have created. &nbsp; How do I get my code in the node&nbsp;to sucessfully read the subfunction k_c? &nbsp; &nbsp; &nbsp; As indicated, you need to add the directory where the .m file containing the function resides to the list of paths that are read in. This is your startup.m file. The other option is to do a "cd" command prior to calling your function to change to the directory where the .m file containing the function resides. Thanks for reiterating the information.&nbsp; My matlab script node is working properly.&nbsp; I had never used the "cd" command in matlab.&nbsp; I always set the working directory when I open the program, and put all the m files into t...

bar
In MatLab 6.5, the routine above works normal: figure; sem=Average(:,2)./sqrt(Average(:,3)); bar([1:1:7],Average(:,1),sem); ylabel('% of epochs analyzed') xlabel('Frequency Band') title ('Occurrence of Oscillatory Events - Ch X') %Where Average and sem are vectors; But, in MatLab 7.0, the same code cause the following error: ??? Error using ==> xychk Too many input arguments. Error in ==> bar at 53 [msg,x,y] = xychk(args{1:nargs},'plot'); Error in ==> cross_subj_analysis>ok_Callback at 327 bar([1:1:7],Average(:,1),sem); I'd like to know why this occour. Thanks Henrique In article <g7a1j6$l1$1@fred.mathworks.com>, Henrique Amaral <henriquetomaz@uol.com.br> wrote: >In MatLab 6.5, the routine above works normal: >figure; >sem=Average(:,2)./sqrt(Average(:,3)); >bar([1:1:7],Average(:,1),sem); >ylabel('% of epochs analyzed') >xlabel('Frequency Band') >title ('Occurrence of Oscillatory Events - Ch X') >%Where Average and sem are vectors; >But, in MatLab 7.0, the same code cause the following error: >??? Error using ==> xychk >Too many input arguments. >Error in ==> bar at 53 > [msg,x,y] = xychk(args{1:nargs},'plot'); >Error in ==> cross_subj_analysis>ok_Callback at 327 >bar([1:1:7],Average(:,1),sem); >I'd like to know why this occour. When the third argument is numeric, it must be the bar width. barwidth must b...

Creating Mex-files from MATLAB code
Could someone please give a link to a good tutorial explaining how MEX-files can be created from Matlab code? P.S. I have a function 'myfun.m' that calls 4 functions 'myfun1.m'-'myfun4.m' Thanks. "Liana" wrote in message <j8mqmv$98v$1@newscl01ah.mathworks.com>... > Could someone please give a link to a good tutorial explaining how MEX-files can be created from Matlab code? P.S. I have a function 'myfun.m' that calls 4 functions 'myfun1.m'-'myfun4.m' > > Thanks. 1) Why do you want to create a mex file from your m-files? 2) Do you want MATLAB to create the mex file ala emlmex? Or are you talking about converting the whole thing to C code? James Tursa Well, I'm just trying to speed up my code. But I don't need a C++ or C shared library, because they operate more slowly due to calling Matlab built-in functions through DLL. Finally I came to the conclusion that my code cannot be compiled into MEX-file, because 'codegen funname.m' says that some of my important sub-functions are not supported for standalone code generation. Is it correct? "James Tursa" wrote in message <j8nb9i$38a$1@newscl01ah.mathworks.com>... > "Liana" wrote in message <j8mqmv$98v$1@newscl01ah.mathworks.com>... > > Could someone please give a link to a good tutorial explaining how MEX-files can be created from Matlab code? P.S. I have a function 'myfun.m' that call...

some problems of codes of MATLAB 7.0 working on MATLAB 6.5
I have used MATLAB for few hours.So I don't know the differences between version 6.5 and 7.0.I want to use some codes of MATLAB 7.0, but they doesn't work in MATLAB 6.5.How to change these codes so that they can work in matlab 6.5.Waiting for your help. Thank you . The codes are like this .I think changing the function findPI may work ,but I don'y know how % PIfun.m % Evaluate a function used to find the PI-line, using Kyle Champley's % method. % % Adam Wunderlich % last update: 5/18/06 function y = PIfun(r,R,h,gamma,x3,sb) temp = R - r*cos(gamma-sb); y = h*((pi - 2*atan(r*sin(gamma-sb)/temp))*(1 + (r^2 - R^2)/ (2*R*temp)) ... + sb) - x3; % find_PI_Line.m % % Find the the parametric interval corresponding to the unique PI-line % passing through the point x for a given helical pitch. % This code implements the method of Kyle Champley. % inputs: P = pitch (cm/turn), R = helix radius, delta_s = s stepsize, x % output: PI = [sb st] % % Adam Wunderlich % last update: 5/18/06 function [PI] = findPI(P,R,delta_s,x) h = P/(2*pi); r = sqrt(x(1)^2+x(2)^2); gamma = atan2(x(2),x(1)); options = optimset('TolX',h*delta_s/100,'FunValCheck','on'); [sb,fval,exitflag] = fzero(@(sb) PIfun(r,R,h,gamma,x(3),sb),... [(x(3)-h*pi)/h,x(3)/h],options); if exitflag ~=1, disp('Error: PI invalid'); end % note that beta=sb in Kyle's formula alphaX = atan(r*sin(gamma-sb)/(R - r*cos(gamma-sb))); st = sb + pi -...

Can we compile .m in .mex for use in matlab?
Hello, Since pcode does not compile subfunction. Can we compile .m in .mex for use in matlab using Matlab Compiler? Also, how can we integrate help header in the .p function? Thanks, ...

compiling a Matlab file into 'c'
Hi all, I have a code which is running really slow in Matlab (due to a long loop), so I thought I should run it in 'c' instead. However, when I enter mcc -B sharedlib:libmyfilename filename.m I get the following warning: ***************** You are using gcc version "4.1.2". The version currently supported with Matlab compiler is "4.3.4". For a list of currently supported compilers see: http://...... ***************** At the moment, I'm using the uni's Linux machine with Matlab 2011b. How can I upgrade gcc version and do I need administrative privilege? Also my main running file refers to several other scripts within the directory. Would this be a problem in compiling? (as I read in help: "functionality that cannot be recalled directly from the command line will not compile"). I think this issue can be resolved by putting all the scripts in one file instead of referring to them (?). Many thanks, Emma I solved the above issue. But, can someone please give me a hint on how to run a Matlab code in 'c' (Xcode)? 1st. step: Type in Matlab command line "mcc -B csharedlib:libmyfilename filename.m" 2nd step: ???? 3rd step: ???? Thanks in advance. PS: 'c' is totally alien to me -- so please bear with me. "Emma Robertson" <ma87@hotmail.co.uk> wrote in message news:j879al$8cr$1@newscl01ah.mathworks.com... > I solved the above issue. But, can someone please...

Matlab crashes when running fortran mex file
First of all, I have ubuntu with gfortran 4.6.1 and f95 4.6.1compiler and I am using the mtlab R2007a. The problem is when I compile the examples code "timetwo.F" given in matlabroot/extern/examples/refboof, compilations goes through but when I run it in the matlab, matlab crashes. I think I have library compatibity issues because the code runs fine on my other machine which have older libraries. Here is what are the libraries in my matlabR2007a/sys/os/glnxa64 folder: libgfortran.so.1 -> /usr/lib/x86_64-linux-gnu/libgfortran.so.3 libiberty.so libXm.so.3 -> libXm.so.3.0.1 libXm.so.3 Note that I have pointed libgfortran.so.1 to the system fortran library rather than the one that came with matlab. But even if I do not change (keep the same that came with matlab), output is the same. It crashes. =========== Also does someone know wht we need to have the libgfortran.so.1 file. Why doesnt it take this library from the system libraries like other C libraries. I am saying this because when I do not have this library and try to start the matlab I get this error: libmwlapack: load error: libgfortran.so.1: cannot open shared object file: No such file or directory terminate called after throwing an instance of 'std::runtime_error' what(): libgfortran.so.1: cannot open shared object file: No such file or directory Aborted Please help me... I am banging my head over this. On 30 Nov, 00:17, "AA " <arvind...@gmail.com&g...

How to release a matrix created in matlab inside mex file.
Dear all. I play around huge matrices with data and when I pass one of them to a mex file, I want to be able to release memory associated with it from inside the mex file. Is this possible? For instance, when I do something like this, it violates memory when called from matlab. Cheers, Pete void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { if (nrhs!=1) { mexPrintf(" - insufficient argument list!\n"); return; } mxArray* xVar=(mxArray*)prhs[0]; mxDestroyArray(xVar); return; } ...

Errors and Warnings after compiling MATLAB GUI m-file
Hello Matlab Community, I need help ASAP! Any thoughts/input on what might be going wrong would be appreciated. I'm new to creating Matlab GUIs. I have created a straight forward GUI that works fine in the Matlab enviroment and consists of simple static text, editable text and push buttons. When I compile to create a stand alone application using 'mcc -o outputfile -m guifilename.m', the warnings and errors below are generated (the GUI does pop-up when I click on the .exe file but does not function): - Warning: Could not find appropriate function on path loading function handle C:\Program Files\MATLAB\R2008a\toolbox\matlab\guide\guidemfile.m@<hObject,eventdata>MFL_GUI<'input1_Callback',hObject,eventdata,guidata<hObject>> > In hgload at 43 In openfig at 78 In gui_mainfcn>local_openfig at 271 In MFL_GUI at 16 (It loops over and over) Then the following: ??? Error using ==> struct2handle Undefined function handle ??? Error using ==> struct2handle Error while evaluating uicontrol CreateFcn Any help would be appreciated... Thanks, J J J wrote: > I need help ASAP! Any thoughts/input on what might be going wrong would > be appreciated. I'm new to creating Matlab GUIs. I have created a > straight forward GUI that works fine in the Matlab enviroment and > consists of simple static text, editable text and push buttons. When I > compile to create a stand alone applicat...

GPIB with Matlab on Mac 10.7.2 (Lion) ?
Hello, I like to access an instrument via GPIB in Matlab on Mac OS X 10.7.2 (Lion). I have installed all the necessary soft- and hardware. I am using an NI GPIB-USB-HS interface. I installed both Matlab 32 and 64-bit versions. I cannot access the GPIB instrument with either Matlab version, but with the provided NI software. I get the following messages: >> instrhwinfo('gpib') ans = InstalledAdaptors: {1x0 cell} JarFileVersion: 'Version 2.9.0' and >> ga = gpib('ni',0,24) ??? Error using ==> gpib.gpib at 150 Unable to load NI GPIB interface. Please check that the necessary drivers are installed on your machine. | Any idea, what I am doing wrong? The NI support says it is a Mathworks issue... "Wilfried" wrote in message <jf14nj$711$1@newscl01ah.mathworks.com>... > Hello, > > I like to access an instrument via GPIB in Matlab on Mac OS X 10.7.2 (Lion). I have installed all the necessary soft- and hardware. I am using an NI GPIB-USB-HS interface. I installed both Matlab 32 and 64-bit versions. I cannot access the GPIB instrument with either Matlab version, but with the provided NI software. > > I get the following messages: > >> instrhwinfo('gpib') > ans = > InstalledAdaptors: {1x0 cell} > JarFileVersion: 'Version 2.9.0' > > and > > >> ga = gpib('ni',0,24) > ??? Error using ==> gpib.gpib at 150 > ...

instrument control toolbox on mac osx 10.6
Hi there, I'm using matlab 2010a on a mac osx (10.6) launching the application in 32 bit mode to successfully use the instrument control box both with gpib and visa. I'd like to move to 2011b to get also the possibility to use the Gige support in the Image Acquisition Toolbox. But this release cannot be launched in 32bit mode so the instrument control box seems to be useless. Is it correct? Is there a possibility to have both the toolboxes running?? any hint/discussion really appreciated. thank you ciao Peppe "Giuseppe Pesce" <giuseppe.pesce.NOSPAM@fisica.unina.it> wrote in message <jfp7qn$fsd$1@newscl01ah.mathworks.com>... > Hi there, > > I'm using matlab 2010a on a mac osx (10.6) launching the application in 32 bit mode to successfully use the instrument control box both with gpib and visa. > I'd like to move to 2011b to get also the possibility to use the Gige support in the Image Acquisition Toolbox. > > But this release cannot be launched in 32bit mode so the instrument control box seems to be useless. > > Is it correct? Is there a possibility to have both the toolboxes running?? > > any hint/discussion really appreciated. > > thank you > > ciao > > Peppe Hi, MATLAB R2011a is not available for 32-bit Mac OSX. Please see this website for more details on platform support. http://www.mathworks.com/support/sysreq/roadmap.html Hope this helps, -Ankit &qu...

Re: Digital Visual Fortran 6.0 and matlab mex
I am working with Matlab 7.11.0 (2010b). Is it possible to mex with digital visual fortran 6.0? I know that this compiler is outdated and not supported for this version of Matlab. "Manish Thorat" wrote in message <j20var$1ni$1@newscl01ah.mathworks.com>... > I am working with Matlab 7.11.0 (2010b). Is it possible to mex with digital visual fortran 6.0? I know that this compiler is outdated and not supported for this version of Matlab. Maybe, but there are some caveats. 1) The last MATLAB version that supported DVF 6.0 was version 6.5 release 13 according to their website. 2) Even though official support was dropped after that release, you can often get later versions of MATLAB to work with older compilers by simply copying the old mex options files to the new version mexopts folder. E.g., for Compaq Visual Fortran 6.1, which I have, I simply copy the following files to the later version MATLAB mexopts folder and things will work: cvf61engmatopts.bat cvf61opts.bat cvf61opts.stp This has worked for me through MATLAB R2010b, even though CVF 6.1 support was only officially supported through MATLAB 2007b. So you might get things to work by copying your old DVF 6.0 mex options files to the new mexopts directory. Maybe they are called something like dvf60engmatopts.bat or similar. I don't have access to a version that has these so I don't know precisely what the file names are. 3) MATLAB version R2009b was the last version that shipped with the BLA...

What is the best way to import Excel files, with stock data, into Matlab? I’m using Matlab R2010b (64-bit)
What is the best way to import Excel files, with stock data, into Matlab? I’m using Matlab R2010b (64-bit) I’m trying to import historical prices of stock data. Matlab keeps cutting off the header of each column; it gives me only values. I am thinking that this is a data-type-mixing-issue, or whatever it’s called. I have ‘Dates’ in ColumnA, and ‘MSFT’, ‘PWER’, ‘KO’, and ‘SBUX’, in ColumnB-ColumnE. Basically, if I put the Excel file in my Matlab folder and double-click the file, I see the values in a matrix (no dates and no headers), I hit ‘Next’. Then, I see only one option; one radio button is enabled – ‘Create variable matching preview’. The other two options, ‘Create vectors from each column using column names’ and ‘Create vectors from each row using row names’ – both are greyed out. I’ve seen videos, on YouTube and on the Matlab site, where people import excel data and these options are NOT greyed out. No matter what I do, there options are ALWAYS greyed out. The problem is, when I click ‘Finish’ in my ‘Workspace’ I have a variable named ‘data’ all values in a 575x4 matrix, but I have NO DATES and I have NO HEADERS on the columns. All of this seems to go into another variable, called ‘textdata’; all dates and headers ate in textdata. This is VERY inconvenient. I’m trying to analyze some stock data and I have no headers, so I have no idea which stock is which (I can figure it out, but I think Matlab should do this for me). Also, I have no dates corresponding to ...

Using GotoBLAS2 in a MATLAB MEX file (shared library help?)
Hi, I have been having a lot of trouble using the GotoBLAS2 library with a C program, which I want to call via the MEX interface. Basically, I have some numerical optimization code in C that I want to use in a MATLAB script. I am trying to link the code to GotoBLAS2 for a fast BLAS library. Based on an example I saw of the use of this code, I am compiling it with the linker options -llapack -lgoto2 to link it with GotoBLAS2. I have a separate stand-alone program (non-MEX) which compiles this way and works fine. However, when I compile the MEX version and then run it, the LAPACK functions I call end up going to the MATLAB LAPACK libraries, which do not seem to be compatible. For example, my code contains a LAPACK call such as int work_sz = -1; dsytrf("U", (int *)&m, NULL, (int *)&m, NULL, (LM_REAL *)&tmp, (int *)&work_sz, (int *)&info); I understand this code is supposed to make a direct call to a FORTRAN library, since C and FORTRAN have the same calling conventions (?), and in my stand-alone program it works. However, if I execute the same call using MATLAB's gdb debugging, I see the error MKL ERROR: Parameter 7 was incorrect on entry to DSYTRF. This tells me that the "dsytrf_" symbol is actually being loaded from the Intel Math Kernel Library (which comes with MATLAB) instead of the LAPACK my stand-alone program uses (which is in /usr/lib/liblapack.so). So my question is this: how can I choose which LAPACK library my MEX-...

matlab file
i need to know how we calculate euclideandistance of a bitstream/codeword based on the channel gain of that particular codeword/bitstream subchannel ...

Web resources about - Compiling Mex file, MAC OSX 10.6, MATLAB R2010a - comp.soft-sys.matlab

Cool tools for compiling to JavaScript
Every programmer has a favorite language or two. JavaScript lovers are the luckiest these days because their language is taking over the Internet ...

Feds put protest activity under microscope in compiling national 'risk forecast'
Use of social media, the spread of "citizen journalism," and the involvement of young people are among the key trends highlighted by a federal ...

10 Tips For Compiling A Deal Sheet
Compiling a deal sheet is a great way of taking stock of your experience and of seeing where your experience may be lacking.

Compiling 64-Bit Code
Describes the 64-bit features available in OS X.

Is there a benefit to compiling your code as you go?
Stack Exchange This Q&A is part of a weekly series of posts highlighting common questions encountered by technophiles and answered by users ...

6 cool tools for compiling to JavaScript
Every programmer has a favorite language or two. JavaScript lovers are the luckiest these days because their language is taking over the Internet ...

Compiling The Absurd Box Score For Space Jam ; Or, Shawn Bradley Sucked Against Cartoons, Too
This is Regressing, a numbers-minded column by our clever friends at the Harvard College Sports Analysis Collective. Over the next few days, ...

We're Compiling Every Police-Involved Shooting In America. Help Us.
The United States has no database of police shootings. There is no standardized process by which officers log when they've discharged their weapons ...

Flat UI Pro Tutorial: Setting and Compiling Using LESS
In this video tutorial, you use components from Flat UI Pro to create a complete simple mail app using LESS. He takes you through the steps to ...

Industrious 4chan user is compiling a list of every videogame ever made
... me to enter a few hundreds of games into my Backloggery account , and I haven't even finished it yet. Ambitious 4chan user Data_baser is compiling ...

Resources last updated: 3/30/2016 6:36:35 PM