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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With