How do I convert a script to a function?
Afficher commentaires plus anciens
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 commentaires
Rik
le 3 Mai 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
le 3 Mai 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
le 3 Mai 2017
Ashley Rains
le 4 Mai 2017
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Data Type Identification dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!