当我在 64 位 Matlab 中运行此代码时,它显示“此函数只能在 MS Windows 或 Linux 上运行”。
% Call the binary executable
fpath = fileparts(which(mfilename));
if strncmp(computer,'PC',2) % MS Windows
exec_str = ['"' fpath '/xcv_segment.exe"'];
elseif strcmp(computer,'GLNX86') % Linux
exec_str = [fpath '/xcv_segment'];
else error('This function can run only with MS Windows or Linux');
end
因此,我尝试安装 lib-32 来安装 glnx86。
sudo -i
cd /etc/apt/sources.list.d
echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
apt-get update
apt-get install ia32-libs
然后,我运行以下命令来安装 32 位 matlab:./install -glnx86
安装后,我运行相同的代码。然而,它一直显示相同的消息:“此函数只能在 MS Windows 或 Linux 上运行”。
最佳答案
computer
函数会检查您正在运行的操作系统。这不是与外部二进制文件(此时甚至没有在代码中调用)或 Matlab 版本相关的错误。这是 if/elseif
部分阻止您继续前进。
在命令行运行computer
,你会看到输出与Matlab版本无关。
您可以通过更改 elseif
以接受 glxna64 来更改该代码以接受 64 位 Linux,但是否运行外部二进制文件则是另一回事。
关于linux - 如何在64位linux机器上运行32位matlab?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30285997/