nargout unavailable in anonymous functions when run from Live Script

1 visualizzazione (ultimi 30 giorni)
The following code works fine at the command line and in mfile scripts.
>>f=@()nargout
>> f()
ans =
0
>> a=f()
a =
1
However, it fails when run as a Live Script:
f=@()nargout;
f()
Error using nargout
You can only call nargin/nargout from within a MATLAB function.

Error in solution (line 1)
f=@()nargout;
a=f()
I am curious as to why.

Risposta accettata

Matt J
Matt J il 9 Set 2022
Modificato: Matt J il 9 Set 2022
Tech Support has classified it as "a bug in MATLAB Live Editor for 'nargout' function".

Più risposte (0)

Categorie

Scopri di più su Argument Definitions in Help Center e File Exchange

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by