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
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
help needed regarding an error using functions
|
RE: help needed regarding an error using functions
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
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
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
disp('I am inside the while loop')
M
--
Dr Michael F Platten