Matlab R2009b中的一个新语法

最近跑老外的程序[1] 又出问题了:

??? Error: File: computeScores.m Line: 17 Column: 28
Unbalanced or unexpected parenthesis or bracket.

我用的是Matlab R2009a,识别出了程序里的几处语法错误:

等等,错误出现在“~”这个符号上。今天看了Steve的博客[2] 才恍然大悟,原来是R2009b之后加入的新语法。

 

“~”的作用是,在使用多输出函数时,如果有的返回值不需要使用,就用“~”来代替。


如:只想得到imgdata的第三维信息:

老方法是:

新方法是:

更详细信息请参考:[345 ]。

Referrences

[1] Bogdan Alexe, Thomas Deselaers and Vittorio Ferrari, What is an object? , CVPR 2010, San Francisco, USA

[2] Too much information about the size function,http://blogs.mathworks.com/steve/2011/03/22/too-much-information-about-the-size-function/

[3] MATLAB Release 2009b - Best New Feature or ~?,http://blogs.mathworks.com/loren/2009/09/11/matlab-release-2009b-best-new-feature-or/

[4] About the unused-argument syntax in R2009b,http://blogs.mathworks.com/steve/2010/01/11/about-the-unused-argument-syntax-in-r2009b/

[5] Ignoring Selected Outputs or Input Arguments,http://www.mathworks.com/help/techdoc/matlab_prog/bresuxt-1.html;jsessionid=7DG4NdZCh9l2QjJ5rpdVW7rDdYFgYhXzc0dyM1KJVFg115xsGGsJ!966180032#br67dkp-1

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值