Reputation: 760
How is it possible in MATLAB to determine if the OS is x64 or x86?
NOTE: I have found the computer
function but it is mentioned that in case a x32 MATLAB is running on a x64 OS then it returns x32 (instead of x64) so this function will not do.
Upvotes: 3
Views: 2244
Reputation: 23858
From your comment, I assume you're running Windows.
Take a look at the environment variables PROCESSOR_ARCHITECTURE and PROCESSOR_ARCHITEW6432. The combination of their presence and values will tell you what you're running under.
x64 Matlab on x64 Windows:
PROCESSOR_ARCHITECTURE=AMD64x86 Matlab on x86 Windows:
PROCESSOR_ARCHITECTURE=x86x86 Matlab on x64 Windows:
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_ARCHITEW6432=AMD64
Then you can use the environment variables PROGRAMFILES, PROGRAMFILES(X86), and PROGRAMW6432 to find the right "Program Files" path to launch your external app from, if it's installed in the conventional location.
Google "WoW64" for more info on how the Windows x64 and x86 environments interact.
Upvotes: 3
Reputation: 5251
On Windows, you could try parsing the output of dos('systeminfo')
, but it's not exactly fast. On Linux, you could try parsing the output of unix('uname -a')
.
Upvotes: 1