matlab mex编程:gcc编译器切换

matlab版本R2014a  gcc原来版本4.8.4

matlab不支持。

matlab最高支持4.7(包括R2015版本也是一样)

1 用sudo apt-get install gcc-4.7安装gcc4.7 同样安装gfortran-4.7 g++4.7

2 sudo vi /usr/local/MATLAB/R2014a/bin/mexopts.sh 把gcc g++ gfortran的地方加后缀-4.7,注意是-4.7 没有‘-’是不行的。

3 sudo cp /usr/local/MATLAB/R2014a/bin/mexopts.sh /home/mri/.matlab/R2014a/mexopts.sh 拷贝到这个目录 /mri是我电脑目录 根据你自己的目录改这个名字。

4 sudo matlab 打开matlab

5 在matlab命令行窗口

   打如下命令

    mex -setup 

  matlab有如下显示:

The options files available for mexsh are:

  1: /usr/local/MATLAB/R2014a/bin/mexopts.sh :
      Template Options file for building MEX-files
 
  0: Exit with no changes

Enter the number of the compiler (0-1):

然后键入1

Overwrite /home/mri/.matlab/R2014a/mexopts.sh ([y]/n)?
输入 y

/usr/local/MATLAB/R2014a/bin/mexopts.sh is being copied to
/home/mri/.matlab/R2014a/mexopts.sh

完成即可。

我的电脑按照此步骤可以运行了。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值