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
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 CenterFile Exchange 中查找有关 Function Creation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by