最近跑老外的程序[1] 又出问题了:
??? Error: File: computeScores.m Line: 17 Column: 28
Unbalanced or unexpected parenthesis or bracket.
我用的是Matlab R2009a,识别出了程序里的几处语法错误:
等等,错误出现在“~”这个符号上。今天看了Steve的博客[2] 才恍然大悟,原来是R2009b之后加入的新语法。
“~”的作用是,在使用多输出函数时,如果有的返回值不需要使用,就用“~”来代替。
如:只想得到imgdata的第三维信息:
老方法是:
新方法是:
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