32 또는 64 비트 MATLAB에서 실행합니까?
문제
32 비트 또는 64 비트 버전의 MATLAB에서 실행 중인지 확인하려면 어떻게해야합니까?
32/64 비트 MATLAB에 따라 다른 경로가 필요한 사전 컴파일 된 MEX 파일이 있습니다.
해결책 2
Scottiet812 및 DWJ 제안을 받아들이면서 몇 가지 포인트를 얻기 위해 내 자신의 솔루션을 게시합니다.
함수 computer
내가 실행중인 아키텍처를 반환합니다. 그래서:
switch computer
case 'GLNX86'
display('32-bit stuff')
case 'GLNXA64'
display('64-bit stuff')
otherwise
display('Not supported')
end
나를 위해 일합니다
다른 팁
32 대 64 비트의 문제는 실제로 붉은 청어입니다. 올바르게 이해하면 어떤 컴파일 된 MEX 파일 세트가 필요한지 결정하여 경로를 적절하게 설정할 수 있습니다. 이를 위해서는 기능을 사용할 수 있습니다 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.
이것이 실제로 작동합니까? 어떤 버전의 Matlab을 사용하고 있습니까?
내가 알고있는 한 64 비트 플랫폼은 86이 아닌 "64"로 끝납니다. Matlab 사이트에서http://www.mathworks.com/access/helpdesk/help/techdoc/ref/computer.html 나는 컴퓨터가 Glnxa86을 반환 할 것이라고 생각하지 않지만 대신 glnxa64.
따라서이 질문은 GNU Linux 32bit 또는 64 비트 버전에만 해당됩니다.
64 비트 플랫폼을 테스트하는 경우 마지막 2자를 테스트하여 "64"를 찾아야 할 것입니다.
if regexp(computer,'..$','match','64'),
% setup 64bit options
else,
% 32bit options
end
제휴하지 않습니다 StackOverflow