"Jos (10584)" wrote in message <firstname.lastname@example.org>... > "Moon Datta" wrote in message <email@example.com>... > > I am dealing with a m file whose first line is > > > > "if nargin < 2, error('%s: there must be at least 2 inputs.',mfilename); end" > > > > but when the program is running the it is giving the error > > > > "there must be at least 2 inputs". > > > > but there is already 5 inputs in the worksheet. I have tried a lot but not understanding properly the reason of error. any help from your side will be helpful to me. > > > > thanks in advance. > > nargin is useful inside functions (m-files of which the first non-comment is the word function). Since you say this line is the first line, I suppose you're dealing with a script, for which nargin returns 0, hence the error. > > I do not know what you mean by "5 inputs in the worksheet". Do you want to say you have 5 variables in your workspace? And that these 5 variables are the be used by the m-file? > > ~ Jos
Thank you sir. yes I have 5 variables in my worksheet and they will be used by the function.