フィルターのクリア

Use of this symbol [~]

48 ビュー (過去 30 日間)
chaos4u2
chaos4u2 2013 年 2 月 24 日
コメント済み: Daniel 2021 年 4 月 23 日
Hello, I have curiosity for the use of this symbol in brackets: [~].
For example, I've seen it, calling a function: [~]=function(S).
Where get stored this symbol, what it contents, and why is it used?
Thanks a lot!

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 2 月 24 日
編集済み: Azzi Abdelmalek 2013 年 2 月 24 日
Example
x=[2 1 3 0 5]
[val,idx]=sort(x)
The result
val =
0 1 2 3 5
idx =
4 2 1 3 5
If we want to get just idx
[~,idx]= sort(x)
the result is
idx =
4 2 1 3 5
  5 件のコメント
Walter Roberson
Walter Roberson 2019 年 5 月 9 日
There is no equivalent in Python. Python cannot return to multiple variables.
You need to design each Python function to return an Object (equivalent to MATLAB struct), or a tuple (which is immutable), or a list.
Whatever you decide, you could put None into the first output location. However, there still needs to be something there to receive the entire set of outputs and pull out the remaining wanted values.
Daniel
Daniel 2021 年 4 月 23 日
Thank you very much!I got it!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCall Python from MATLAB についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by