フィルターのクリア

question on use of Tilde

3 ビュー (過去 30 日間)
Srinivas
Srinivas 2012 年 10 月 7 日
Hi
I was looking at on of the sample code in matlab webinars, I could not understand the use of ~ in the code below , as I understand that ~ (not) is a logical operator.
% Perform a parameter sweep to identify the best setting.
sh = nan(100,1);
for m = 2:100
[~,~,sh(m)] = leadlag(BundClose,1,m);
end
[~,mxInd] = max(sh);
Please help, thanks in advance.
Rgds

採用された回答

Walter Roberson
Walter Roberson 2012 年 10 月 7 日
When ~ appears in the left side of an assignment statement with multiple outputs, it means that that particular output should be discarded.
For example,
[~,mxInd] = max(sh);
is the same as
[TEMP,mxInd] = max(sh);
clear TEMP
This syntax has only been part of MATLAB since about R2009b or so.
  1 件のコメント
Srinivas
Srinivas 2012 年 10 月 7 日
Thanks

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by