×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

help needed regarding an error using functions

help needed regarding an error using functions

help needed regarding an error using functions

(OP)
error : One or more output arguments not assigned during call

RE: help needed regarding an error using functions

Some code/context may help. The function is defined with a number of output arguments. ie the first line of the function m file is

function [output1 output2] = myfunction(input1 input2)

and you are calling the function with

[output1] = myfunction(input1 input2)

M

--
Dr Michael F Platten

RE: help needed regarding an error using functions

(OP)
[S1,S2,x,y,w,h,width,height,area,best,worst,temp]=simulatedannealing(seq1,seq2,T0,A,B,Mt,MAXTIME,x,y,w,h,width,height,oldarea,N,M);

thats a simulatedannealing function that i am calling from my main function called sequencepair

and then my called function

function [S1,S2,x,y,w,h,width,height,area,bestarea,worstarea,temp]=simulatedannealing(seq10,seq20,T0,A,B,Mt,MAXTIME,x,y,w,h,width,height,area,N,M)

and i am also calling a metropolis function from this simulated annealing function.

[S1,S2,x,y,w,h,width,height,area,best,worst,temp]=metropolis(S1,S2,T,Mt,x,y,w,h,width,height,area,N,M);

And my called function

function [S1,S2,x,y,w,h,width,height,area,best,worst,temp]=metropolis(S1,S2,T,Mt,x,y,w,h,width,height,oldarea,N,M)

This is what i have done.
I am getting this error

??? One or more output arguments not assigned during call to 'C:\MATLAB701\work\metropolis.m (metropolis)'.

Error in ==> simulatedannealing at 9
    [S1,S2,x,y,w,h,width,height,area,best,worst,temp]=metropolis(S1,S2,T,Mt,x,y,w,h,width,height,area,N,M);

Error in ==> sequenepair at 19
[S1,S2,x,y,w,h,width,height,area,best,worst,temp]=simulatedannealing(seq1,seq2,T0,A,B,Mt,MAXTIME,x,y,w,h,width,height,oldarea,N,M);


everything seems right for me , i am not able to figure out whats wrong , can anyone helpme with this

RE: help needed regarding an error using functions

(OP)
my metropolis function is the innermost function,it returns some value to simulated annealing function and then simulated annealing function returns some values to main sequence pair function.

Actually there is a while loop inside this metropolis function ,until some condition is satisfied this metropolis function is run.and the values that are going to be outputted by this metropolis function is defined and assigned in the while loop. once it comes out the loop the program should be having those assigned values and it should return it.but if i run like that i am getting the error stated above.

Now what i did is after coming out of the while loop i am again assigned those values which are to retured , then the program is working fine.

so is it compulsory to assign the variables to be returned by the function after while loop.

let me know about this


RE: help needed regarding an error using functions

It sounds to me as if your while loop condition is never satisfied so when you run the metropolis function the output values are never assigned. Try using the debug functions in the Matlab editor. Alternatively, you can do the slightly cruder test of putting a line inside the while loop such as

disp('I am inside the while loop')

M

--
Dr Michael F Platten

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources