How to get all outputs of a function in a cell array
Mostrar comentarios más antiguos
I created a function that has a different number of outputs depending on the inputs. I store the outputs into a cell, varargout. When I call the function to try and get the output, I only get the first element of the cell.
function varargout = testfunc(a,b)
varargout = cell(1,a);
for i = 1:a
varargout{i} = b;
end
end
t = testfunc(3,2)
t =
2
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!