フィルターのクリア

how many parameters can accept a function in MATLAB?

29 ビュー (過去 30 日間)
JULIO Campos
JULIO Campos 2014 年 3 月 18 日
コメント済み: Walter Roberson 2016 年 10 月 27 日
My function has 6 parameters and I get an error 'Too many input argument'
  1 件のコメント
Andrei Bobrov
Andrei Bobrov 2014 年 3 月 18 日
Where your function?

サインインしてコメントする。

回答 (2 件)

Walter Roberson
Walter Roberson 2014 年 3 月 18 日
65500 would be the upper limit.
  4 件のコメント
Adam
Adam 2016 年 10 月 27 日
It's probably a sign that something is maybe wrong in your software designing though if you need 65500 input arguments :)
Walter Roberson
Walter Roberson 2016 年 10 月 27 日
Not necessarily. Remember that the way to efficiently fprintf() a bunch of items with different formats is to put each item into its own cell and then fprintf(fid, format, TheCell{:}) . One should not have to know that there is a magic upper bound beyond which it is needed to break it into pieces.
For example,
str = cellstr( perms('abcde') );
idx = num2cell((1:size(str,1)));
out = [idx; str.'];
fprintf(fid, '%7d: %s', out{:});
One should not have to know that 'abcdefg' could be handled this way but that 'abcdefgh' had to switch strategies due to crossing a magic boundary around 65000 entries.

サインインしてコメントする。


Gaurav Shukla
Gaurav Shukla 2014 年 3 月 18 日
I have tried with 13 parameters and it worked.
The error that u have mentioned will appear if your calling function is passing more parameters than the called function can receive.
Ex: function Called(Arg1, Arg2) end
function Calling () Called(Arg1,Arg2,Arg3) end
  4 件のコメント
Prachi Agarwal
Prachi Agarwal 2016 年 10 月 26 日
output = stegno(img,msg,enc_key,FileName_msg);//calling syntax
function [J] = stegno(img,msg,enc_key,FileName_msg) //function signature
Prachi Agarwal
Prachi Agarwal 2016 年 10 月 26 日
Thank you Adam my code is now working fine. Still, i don't know what was the error.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by