nargout unavailable in anonymous functions when run from Live Script

1 回表示 (過去 30 日間)
Matt J
Matt J 2022 年 9 月 8 日
編集済み: Matt J 2022 年 9 月 9 日
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.

採用された回答

Matt J
Matt J 2022 年 9 月 9 日
編集済み: Matt J 2022 年 9 月 9 日
Tech Support has classified it as "a bug in MATLAB Live Editor for 'nargout' function".

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeArgument Definitions についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by