How do I convert a script to a function?
Mostrar comentarios más antiguos
I am trying to convert the attached script into a function to produce the same figure and results for a plot of the (for argument's sake) Earth orbiting the Sun. I have attached what I have of the function so far, but I am struggling to understand what I have done wrong and how to proceed. The function has pseudocode explanations of variables etc. Any help would be much appreciated. Regards, AR
4 comentarios
Rik
el 3 de Mayo de 2017
There isn't really that much of a difference in this case between a function and a script. The main differences are execution speed optimization and workspace management. So once you have a working script, just add the function line at the top, an end at the bottom, and move some definitions from code to input.
It looks like you are already there. What is your problem exactly?
Jan
el 3 de Mayo de 2017
Whenever you mention in the forum, that you assume something is going wrong, explain the details. Why do you think, that you have done something wrong? It is much easier to solve a problem than to guessm what the problem is.
Ashley Rains
el 3 de Mayo de 2017
Ashley Rains
el 4 de Mayo de 2017
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Data Type Identification en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!