什么是%#ok< SAGROW>评论是什么意思? [英] What does %#ok<SAGROW> comment mean in MATLAB?
问题描述
我遇到过许多具有%#ok< SAGROW>
注释的MATLAB代码。
I've encountered many MATLAB codes which have a %#ok<SAGROW>
comments. This comment is used in different circumstances and I can't figure it out what it means.
例如:
i = 1;
flag = true;
for l = 1:k
while(flag==true)
if(probs(i)~=0)
leaves(l).val = i-1; %#ok<*SAGROW>
leaves(l).zero = '';
leaves(l).one = '';
leaves(l).prob = probs(i);
i = i + 1;
flag = false;
else
i = i+1;
flag = true;
end
end
flag =true;
end
还有其他引用这个注释,对于instace:
There are other references to this comment too, for instace:
- http://www.codeproject。 com / Questions / 151765 / answer.aspx
- http://www.scribd.com/doc/69869075/EEE-554-Matlab-Solutions
- http://www.mathworks.com/matlabcentral/newsreader/view_thread/321047
- http://www.nd.edu/~jrunkle1/ballis_problem.m
- http://www.codeproject.com/Questions/151765/answer.aspx
- http://www.scribd.com/doc/69869075/EEE-554-Matlab-Solutions
- http://www.mathworks.com/matlabcentral/newsreader/view_thread/321047
- http://www.nd.edu/~jrunkle1/ballis_problem.m
推荐答案
它抑制 mlint
警告。在这种特定情况下,它不是预先分配数组。
It suppresses mlint
warnings. In this specific case, it is about not pre-allocating an array.
mlint 是Matlab的静态代码分析工具之一。它会发现可能的错误并显示警告。
mlint is one of the static code analysis tools that Matlab has. It finds possible errors and shows warnings.
编辑(1):
我刚刚注意到您的问题是关于 SAGROW
,而不是 AGROW
。我找不到它。我的猜测是,它是一个旧的/新的mlint语法。
Edit(1):
I've just noticed that your question is about SAGROW
, not AGROW
. I could not find it. My guess is that it is an old/new mlint syntax.
这篇关于什么是%#ok< SAGROW>评论是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!