M-file for exercise!!!
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Hi!I have to create an m-file for an exercise and I wanted to ask you what is the difference between a function and a script.Which of them is better??
2 Commenti
Risposte (2)
sixwwwwww
il 5 Dic 2013
If you want to re-use some operation again and again then function is better and if you just wanted to start writing codes in MATLAB then script is better at first. Better or not depends upon functionality usually
8 Commenti
sixwwwwww
il 5 Dic 2013
I am getting result both from your script and function. Following are the inputs: For function
test(zeros(50, 1), 50, 0.00001, 50)
For script
Give dimension: 50
Give e: 0.00001
Give maxit: 50
Give x_0: zeros(50, 1)
then why you dont get correct result. Can you check what inputs you give to both your function and script?
Andreas Goser
il 5 Dic 2013
Modificato: Andreas Goser
il 5 Dic 2013
The documentation for this is also quite good:
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!