What does the character ~ mean in these code?
15 次查看(过去 30 天)
显示 更早的评论
Hi all, I'm confused by the sentence as following:
[~,ind] = min(dist(:));
Could you tell me what does the character "~" mean in this code?
I appreciate your answer.
1 个评论
Daniel Shub
2012-5-23
Related question: http://www.mathworks.co.uk/matlabcentral/answers/37858-the-sign-is-not-backwards-compatible
采纳的回答
the cyclist
2012-5-23
It is a "dummy" output, meaning that even though MATLAB normally generates that output, you know that you do not need it later in your code. In your particular case, you need the second output (the index), but you don't need the first output (the value of the minimum).
3 个评论
Walter Roberson
2012-5-23
Note: older versions of MATLAB do not support this syntax. If your version of MATLAB reports an invalid operation at that point, then substitute any convenient temporary variable name for the ~ . For example,
[junk, ind] = min(dist(:));
clear junk
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!