Running on 32 or 64 bit matlab?

By : peje

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.

By : peje


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')
        display('Not supported')

works for me

By : peje

Does this really work? Which version of matlab are you using?

As far as I'm aware the 64 bit platforms end with "64" not 86. From the matlab site I don't think that computer will ever return GLNXA86 but GLNXA64 instead.

So this question is specific to GNU Linux 32bit or 64bit version.

If you are testing for any 64bit platform then you probably need to test the last 2 characters to find "64" i.e. something like

if regexp(computer,'..$','match','64'),
   % setup 64bit options
   % 32bit options
By : Adrian

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

    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 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.

This video can help you solving your question :)
By: admin