iterating function, how to return a value and return to function
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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 comentarios
Roger Stafford
el 26 de Dic. de 2017
@Olga: You will have to do a better job of explaining your question in order to get a respectable, helpful answer. If you read the description of matlab functions carefully, you will realize there is no automatic "return" to a function without a specific action in the coding that calls on the function. The conditions you describe either must be built into the function itself or the caller must deal with them and resort to possible multiple calls on the function.
OJ27
el 26 de Dic. de 2017
OJ27
el 26 de Dic. de 2017
Respuestas (0)
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
