How many input variables can a MATLAB function have?

조회 수: 15 (최근 30일)
John
John 2013년 11월 13일
댓글: Walter Roberson 2013년 11월 13일
I cant find the right answer for this question. Any help would be truly appreciate.
Thanks

답변 (2개)

Walter Roberson
Walter Roberson 2013년 11월 13일
65500 as best I recall.

The Matlab Spot
The Matlab Spot 2013년 11월 13일
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
Walter Roberson
Walter Roberson 2013년 11월 13일
Ah... my answer was in terms of named variables; I was not considering varargin

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Financial Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by