M-file for exercise!!!
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (2개)
sixwwwwww
2013년 12월 5일
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
sixwwwwww
2013년 12월 5일
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
2013년 12월 5일
편집: Andreas Goser
2013년 12월 5일
The documentation for this is also quite good:
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!