필터 지우기
필터 지우기

What does the character ~ mean in these code?

조회 수: 2 (최근 30일)
Yu Zhang
Yu Zhang 2012년 5월 23일
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
Daniel Shub 2012년 5월 23일
Related question: http://www.mathworks.co.uk/matlabcentral/answers/37858-the-sign-is-not-backwards-compatible

댓글을 달려면 로그인하십시오.

채택된 답변

the cyclist
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
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
Yu Zhang
Yu Zhang 2012년 5월 23일
It works!!!
Thank you VERY much!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by