Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

iterating function, how to return a value and return to function

조회 수: 1 (최근 30일)
OJ27
OJ27 2017년 12월 26일
마감: OJ27 2017년 12월 26일
Happy Holidays Matlab Community. I have a programming question. I am trying to do minimization and need help coding it.
function my_function(a,b,c,d) % %calculations p, new_c, new_d and others % if condition1 return p; elseif condition2 my_function(a,b,new_c,d); else my_function(a,b,c,new_d); end end
I know return p; does not exist, only return/break to exit the loop. However, to my understanding, I would have to define p=my_function(a,b,c,d);
any tips on how to code this?
  댓글 수: 3
OJ27
OJ27 2017년 12월 26일
I didn't realize the formatting was off for the question and did not want to bother anyone with calculations. But here it is the algorithm.
When I want to return p only when the condition is satisfied, otherwise I want to keep looping.

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by