COMPGROUPS.NET | Search | Post Question | Groups | Stream | About | Register

### too many input/output arguments

• Email
• Follow

```Hey all, i really need some help at the moment, as i keep getting the error message

Too many input arguments.

Error in ==> errq3assignment at 11

I am using the function as shown below and have pretty much hit a brick wall with what to do now. Any help would be greatly appreciated. Below the function below i will show you the question i am trying to solve. Many Thanks.

function errq3assignment
clc
% exact_ans=trapez(15000);
% for i=1:15000
%     approx_ans=trapez(i);
%     error=abs((exact_ans-approx_ans)/exact_ans)
%     if error<=0.001
%         break
%     end
% end

trial_integral = 0;
N = 100;
while 1

if abs((trial_integral-integral)/integral) < 0.001
break;
end

N=N+1;

end

disp(N);
disp(integral);
disp(trial_integral);

end

The energy E stored in the spring, at equilibrium, may be expressed in the form
E =
&#8747; d
0
F(x)dx
Use the composite trapezoidal rule to obtain an approximation to the value of E, with a relative
error of less than 0:001%.
Note the 6 digits uvwxyz of your student number. You should then use the parameter values
k1 = 45000  (1+u) k2 = 8100  (1+v) m = 960  (1:2 &#1048576; 0:1  w)
h = 0:43  (1+0:1  x) g = 9:8  (1+0:01  y)
a = 1+0:01  z b = 1:5+0:01  u
To illustrated the process of creating the problem data, suppose your student number is 970254. In this case, u = 9,
v = 7, w = 0, x = 2, y = 5 and z = 4. Your solution should then be for the parameter values
k1 = 450000 k2 = 64800 m = 1152 g = 10:29
h = 0:516 a = 1:04 b = 1:59
4
```
 0

See related articles to this posting

```luke baldwin wrote:
> Hey all, i really need some help at the moment, as i keep getting the
> error message
> ??? Error using ==> answerassignmentq3
> Too many input arguments.
>
> Error in ==> errq3assignment at 11
>
> I am using the function as shown below and have pretty much hit a brick
> wall with what to do now. Any help would be greatly appreciated. Below
> the function below i will show you the question i am trying to solve.
> Many Thanks.
>
>
>
> function errq3assignment
....

Well, the function definition doesn't accept _any_ arguments, so when
you try to call it with one, it's not surprising Matlab complains.

Got to fix either the function definition to accept a value if you want
it to do so or else don't try to call it with a value if it doesn't
allow same....all in all, pretty sraightforward it would seem.

--
```
 0

```On 09/12/10 10:15 AM, luke baldwin wrote:
> Hey all, i really need some help at the moment, as i keep getting the
> error message
> ??? Error using ==> answerassignmentq3
> Too many input arguments.
>
> Error in ==> errq3assignment at 11

We don't know, as you have not shown us the code for answerassignmentq3 .
```
 0

```Walter Roberson <roberson@hushmail.com> wrote in message <RY7Mo.6764\$KT3.5241@newsfe08.iad>...
> On 09/12/10 10:15 AM, luke baldwin wrote:
> > Hey all, i really need some help at the moment, as i keep getting the
> > error message
> > ??? Error using ==> answerassignmentq3
> > Too many input arguments.
> >
> > Error in ==> errq3assignment at 11
>
> We don't know, as you have not shown us the code for answerassignmentq3 .

The codeis shown at the top as it is with the % signs before it
```
 0

```"luke baldwin" <487605@swansea.ac.uk> wrote in message <idr5bd\$n2a\$1@fred.mathworks.com>...
> Walter Roberson <roberson@hushmail.com> wrote in message <RY7Mo.6764\$KT3.5241@newsfe08.iad>...
> > On 09/12/10 10:15 AM, luke baldwin wrote:
> > > Hey all, i really need some help at the moment, as i keep getting the
> > > error message
> > > ??? Error using ==> answerassignmentq3
> > > Too many input arguments.
> > >
> > > Error in ==> errq3assignment at 11
> > > integral = answerassignmentq3(1500);
> >
> > We don't know, as you have not shown us the code for answerassignmentq3 .
>
This is the code used for answerassignmentq3

% exact_ans=trapez(15000);
% for i=1:15000
% approx_ans=trapez(i);
% error=abs((exact_ans-approx_ans)/exact_ans)
% if error<=0.001
% break
% end
% end

What needs to be added or removed in order for this to work, or is the code far too problematic, i am unsure of everything as it is a code that i had used last year and wondered if it still worked.
```
 0

```On 09/12/10 11:58 AM, luke baldwin wrote:
> Walter Roberson <roberson@hushmail.com> wrote in message
>> On 09/12/10 10:15 AM, luke baldwin wrote:
>> > Hey all, i really need some help at the moment, as i keep getting the
>> > error message
>> > ??? Error using ==> answerassignmentq3
>> > Too many input arguments.
>> >
>> > Error in ==> errq3assignment at 11
>>
>> We don't know, as you have not shown us the code for answerassignmentq3 .
>
> The codeis shown at the top as it is with the % signs before it

No it isn't. The part you posted that has the % signs in front of it has
no 'function' declaration in it, so it is just random code included for
no obvious reasons. We need to see the code for the complete function
answerassignmentq3 to be able to tell you why it isn't working. We need
to see what the output arguments are on the left hand side and we need
to see what the input arguments are on the right hand side.
```
 0

```On 09/12/10 12:09 PM, luke baldwin wrote:

> This is the code used for answerassignmentq3
>
> % exact_ans=trapez(15000);
> % for i=1:15000
> % approx_ans=trapez(i);
> % error=abs((exact_ans-approx_ans)/exact_ans)
> % if error<=0.001
> % break
> % end
> % end

If that is _exactly_ what is stored in answerassignmentq3.m then when
attempting to invoke a script as a function. As that is not the error
you got, we conclude that that is NOT your code for answerassignmentq3.m
```
 0

```luke baldwin wrote:
> "luke baldwin" <487605@swansea.ac.uk> wrote in message
> <idr5bd\$n2a\$1@fred.mathworks.com>...
>> Walter Roberson <roberson@hushmail.com> wrote in message
>> > On 09/12/10 10:15 AM, luke baldwin wrote:
>> > > Hey all, i really need some help at the moment, as i keep getting the
>> > > error message
>> > > ??? Error using ==> answerassignmentq3
>> > > Too many input arguments.
>> > >
>> > > Error in ==> errq3assignment at 11
>> > > integral = answerassignmentq3(1500);
>> > > We don't know, as you have not shown us the code for
>>
> This is the code used for answerassignmentq3
>
> % exact_ans=trapez(15000);
....
> % end
>
> What needs to be added or removed in order for this to work, or is the
> code far too problematic, i am unsure of everything as it is a code that
> i had used last year and wondered if it still worked.

Well, it couldn't have ever worked--as Walter says, it isn't a function
at all and there's nothing to execute, anyway, even if it were.

I did look too quickly initially and made an error in that the function
shown wasn't the one that had the error--however, one would presume from
the error message that what you really have is another function of the
same form--ie, one not expecting any input arguments.

But, as Walter says, until a complete and functional and self-consistent
set of code is posted, it's the crystal ball talking, not analysis...

--
```
 0

```many thanks, all sorted i have found my other file and now all works fine.

Walter Roberson <roberson@hushmail.com> wrote in message <109Mo.1430\$3l4.634@newsfe04.iad>...
> On 09/12/10 12:09 PM, luke baldwin wrote:
>
> > This is the code used for answerassignmentq3
> >
> > % exact_ans=trapez(15000);
> > % for i=1:15000
> > % approx_ans=trapez(i);
> > % error=abs((exact_ans-approx_ans)/exact_ans)
> > % if error<=0.001
> > % break
> > % end
> > % end
>
> If that is _exactly_ what is stored in answerassignmentq3.m then when
> attempting to invoke a script as a function. As that is not the error
> you got, we conclude that that is NOT your code for answerassignmentq3.m
```
 0

8 Replies
439 Views

Similar Articles

12/22/2013 5:11:10 AM
page loaded in 5293 ms. (0)

Similar Artilces:

Too many output arguments
Hi, I am running an "if" loop (i=1:size(x,2)), and keep on getting a "Too many output arguments" error, but it seems to be at random indexes: when I run it all over again, I get the same message, but the break occurs at a different index (value of i).. THERE IS A PART OF THE CODE: for i=1:size(x,2) if x(i)>c if x(i)<c_bar_zero_r lower(i)=fzero(@(t) 1-normcdf(x(i)-t)+normcdf(x(i)-2*c-r*slength(t,c)-t)-alpha*(1-normcdf(c-t)+1-normcdf(c+t)),[-mu1_tilda,0]); upper(i)=fzero(@(t) normcdf(x(i)+r*slength(t,c)-t)-normcdf(x(i)-t)-(1-alpha)*(1-no...

tilde input and output arguments
I'm just now getting acquainted with this feature, which lets you specify unneeded input/output arguments using tildes http://www.mathworks.com/access/helpdesk/help/techdoc/rn/br5fo8o-1.html#br65zmd-1 I'm wondering if there is a way to detect whether a user-written function has been called with output arguments that are tildes, so that we can code the function to exploit this feature. Perhaps I'm getting ahead of myself, so let me ask a more preliminary question. When a native MATLAB function is called as follows [~,B]=func(X) %Case 1 is there any difference i...

too many input arguments #4
Hi, I am trying to change a classification class called classregtree. I want to use another criteria for splitting the nodes.The problem is,I dont want to write my function inside of the code of the classregtree class because I need it for future use,so I copied all of the code into another .m class file,changed the class name to classtree and saved it as classtree.m . but when I run classtree(....) instead od classregtree I get this error : too many input arguments. they are both the same class with different names,Why does this happen ...

Input/Output Arguments for Callbacks
Hi Again, I have a GUI with its callbacks from several CheckBoxes and PopUp Buttons. In these Callbacks, depending on the user´s selection, a DataTable with data is changed (with stuff like '1' when a Checkbox is checked and the PopUp Value when its changed by user). In this order, in my code i´ve defined my DataTable: TabHandles{NumberOfTabs+3,1} = Answers_Table; % Answers Table TabHandles{NumberOfTabs+3,2} = Dates_Table; % Data Answers Table After that, for example, a CheckBox UiControl is defined by: hTab1_CB1=uicontrol('Callback', @Tab1_CB1C...

Getting input and output arguments
Is there a function that gets the names of the input and output arguments in a different function. e.g. give a function as follows function [out1 out2] = myfunc(in1, in2) get_ioargs(@myfunc) returns in{1} 'in1' in{2} 'in2' out{1} 'out1' out{2} 'out2' or something of that sort. "Mike " <mike75513@hotmail.com> wrote in message news:i9kkoh\$iku\$1@fred.mathworks.com... > Is there a function that gets the names of the input and output arguments > in a different function. e.g. ...

Error:Too many input arguments
Hi guys, I had a self-defined function. WhenI run it it will return error "Too many input arguments". How can I know the max input argument number of matlab function? Thanks. On Dec 11, 11:28=A0am, "Tiger Smith" <loscl...@gmail.com> wrote: > Hi guys, > I had a self-defined function. > WhenI run it it will return error "Too many input arguments". > How can I know the max input argument number of matlab function? > Thanks. How many inputs did you define for your function? If you want a variable number of inputs, use varargin as th...

from few to many, input/output question
sample code snippet filename a 'junk.txt'; data a;infile a truncover;length grp \$ 1; input grp g1-g4;put (_all_) (=); run; junk.txt looks like this a 1 b 1 c 2 3 d 1 2 3 4 e 2 the goal is to have a dataset grp=a g1=1 g2=. g3=. g4=. grp=b g1=1 g2=. g3=. g4=. grp=c g1= g2=2 g3=3 g4=. grp=d g1=1 g2=2 g3=3 g4=4 grp=e g1=. g2=2 g3=. g4=. and then I need to create a new line for each grp where there is a value in either g1-g4, like grp=a g1=1 grp=b g1=1 grp=c g2=2 grp=c g3=3 tips and tricks, please "Arto Raiskio" <arto.raiskio@suomenposti.com> wrot...

ODE45
Hi all, I just started using MATLAB...I'm trying to work with ODE45, but even when I'm copying different simple online examples, I keep getting the same error message: ??? Error using ==> ode45 Too many input arguments. What am I doing wrong? Sebastian ...

Too many input arguments 396433
Hi to all, I have tried to open an image using icalab. I have saved my file .mat(contents a series of images) on desktop. First of all I open icalab toolbox(in this phase I haven't any problem), after I tried to LOAD an image but in command window I have following error: ??? Error using ==> cd Too many input arguments. Error in ==> E:\Documents and Settings\Fabio\Desktop\icalab2d\ICALABIPv2_0\imselect.p>imselect at 46 Error in ==> E:\Documents and Settings\Fabio\Desktop\icalab2d\ICALABIPv2_0\readimage.p>readimage at 38 ??? Error while evaluating uico...

Too many input arguments 407541
Hi, I'm having some trouble with a function i'm calling. Apparently, it gives an error when the function is called from my program. it says "Too many input arguments", which is strange because i give it all that it needs. I call the function as shown below: [Upper_Limit_A, Lower_Limit_A, Upper_Limit_B, Lower_Limit_B] = Rule2(n, A, B, fid); My thoughts are because of the "fid". In this function, i want it to write to a file which i have opened, and am writing to, in the main program as well. Could that be the reason it's giving this error? is there a wa...