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

5 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

MathWorks Support Team
MathWorks Support Team am 27 Jun. 2009
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);

Weitere Antworten (0)

Kategorien

Mehr zu Function Creation finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by