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

6 visualizaciones (últimos 30 días)
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.

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Function Creation en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by