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...

Antworten (1)

Jan
Jan am 31 Mär. 2022
Bearbeitet: Jan am 31 Mär. 2022

0 Stimmen

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.

Kategorien

Mehr zu Startup and Shutdown finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2022a

Tags

Gefragt:

am 31 Mär. 2022

Bearbeitet:

Jan
am 31 Mär. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by