Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running on 32 or 64 bit matlab?

How can I determine if I'm running on a 32bit or a 64bit version of matlab?

I have some pre-compiled mex-files which need different path's depending on 32/64bit matlab.

like image 767
peje Avatar asked Oct 13 '08 06:10

peje


2 Answers

The question of 32 vs. 64 bits is really a red herring. If I understand correctly, you want to determine which set of compiled MEX files are needed so you can set the path appropriately. For this, you can use the function mexext:

>> help mexext
 MEXEXT MEX filename extension for this platform, or all platforms. 
    EXT = MEXEXT returns the MEX-file name extension for the current
    platform. 

    ALLEXT = MEXEXT('all') returns a struct with fields 'arch' and 'ext' 
    describing MEX-file name extensions for all platforms.

    There is a script named mexext.bat on Windows and mexext.sh on UNIX
    that is intended to be used outside MATLAB in makefiles or scripts. Use
    that script instead of explicitly specifying the MEX-file extension in
    a makefile or script. The script is located in $MATLAB\bin.

    See also MEX, MEXDEBUG.
like image 198
Vebjorn Ljosa Avatar answered Nov 10 '22 04:11

Vebjorn Ljosa


Taking up on ScottieT812 and dwj suggestions, I post my own solution to earn some points.

The function computer returns the architecture I'm running on. so:

switch computer
    case 'GLNX86'
        display('32-bit stuff')
    case 'GLNXA64'
        display('64-bit stuff')
    otherwise
        display('Not supported')
end

works for me

like image 29
peje Avatar answered Nov 10 '22 04:11

peje