How can I return multiple output arguments from the INLINE function?

5 ビュー (過去 30 日間)
I am using the INLINE function and I see that there is no way to get multiple outputs from the INLINE function. An example of this would be as follows:
[a, b] = meshgrid(1, 1)
returns
a =
1
b =
1
If I now inline this function as follows:
f = inline('meshgrid(x, y)')
I obtain
f =
Inline function:
f(x,y) = meshgrid(x, y)
Typing
[a, b] = f(1, 1)
results in the following error:
??? Error using ==> inline.subsref
Too many output arguments.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
The ability to obtain multiple output arguments with the INLINE function is not available in MATLAB.
To work around this issue, use function handles as follows:
f = @meshgrid;
[a, b] = f(1, 1);

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFunction Creation についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by