Borrar filtros
Borrar filtros

How many input variables can a MATLAB function have?

6 visualizaciones (últimos 30 días)
John
John el 13 de Nov. de 2013
Comentada: Walter Roberson el 13 de Nov. de 2013
I cant find the right answer for this question. Any help would be truly appreciate.
Thanks

Respuestas (2)

Walter Roberson
Walter Roberson el 13 de Nov. de 2013
65500 as best I recall.

The Matlab Spot
The Matlab Spot el 13 de Nov. de 2013
You can find the number of input arguments supported on the matlab version that you are using the example below: I was able to call a function with 100000 input arguments to test...
E.g. At the Command Prompt construct a test string of arguments...
s='';for n=1:100000,s=[s,' ',num2str(n)];end
Write a Function to be called...
function [varargout] = TestFunc(varargin)
disp(['This function was called with ',num2str(nargin),' arguments']);
end
Test on Command Prompt
>> eval(['TestFunc ',s,';'])
This function was called with 100000 arguments
  1 comentario
Walter Roberson
Walter Roberson el 13 de Nov. de 2013
Ah... my answer was in terms of named variables; I was not considering varargin

Iniciar sesión para comentar.

Categorías

Más información sobre Argument Definitions en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by