Why does not Matlab language support function/operator chaining?

E.g.:
setdiff(1:3, randi(3))(randi(2))
One must factor out the resulting list from setdiff into a separate variable first:
t = setdiff(1:3, randi(3));
t(randi(2))
This is so medieval even by 1980s standards...

回答 (1 件)

Jan
Jan 2022 年 3 月 31 日
編集済み: Jan 2022 年 3 月 31 日

0 投票

Matlab does not support this, because it has not been implemented yet.
Sorry. The answer is trivial.
I'm using Matlab to solve problems. It did not prevent me to find a solution, that I have to store the output in a variable before I can apply an index.

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

製品

リリース

R2022a

タグ

質問済み:

2022 年 3 月 31 日

編集済み:

Jan
2022 年 3 月 31 日

Community Treasure Hunt

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

Start Hunting!

Translated by