Prev: Is Matlab overkill for this financial need?
Next: convert periodogram PSD estimation to signal amplitude
From: William on 31 Jul 2010 20:17 Hi, Im trying to turn my script into a function today, but i dont seem to understand how to do it. function T = trajectory(V,p,angle) % %documentation <my script here> % % end That is my understanding of how to create a function. When I do that however I cannot recall on "trajectory" as a function of matlab. Just wondering what I am forgetting. Thanks in advance.
From: Matt Fig on 31 Jul 2010 20:50 Put this into a new M-File (by typing at the command line: edit) called myfunc. Then save the file (ctrl+s). function B = myfunc(A) % Double your number B = 2*A; Then from the command line type: double3 = myfunc(3)
From: reza on 31 Jul 2010 22:00 The file name needs to be the same as the function name. Once this happens and when the file is on your matlab path (see pathtool) then you'll be able to call it. /m On Jul 31, 8:17 pm, "William " <william.bax...(a)oit.edu> wrote: > Hi, Im trying to turn my script into a function today, but i dont seem to understand how to do it. > > function T = trajectory(V,p,angle) > % > %documentation > > <my script here> > > % > % > end > > That is my understanding of how to create a function. When I do that however I cannot recall on "trajectory" as a function of matlab. Just wondering what I am forgetting. Thanks in advance.
From: ImageAnalyst on 31 Jul 2010 23:53
On Jul 31, 10:00 pm, reza <mjahan...(a)gmail.com> wrote: > The file name needs to be the same as the function name. Once this > happens and when the file is on your matlab path (see pathtool) then > you'll be able to call it. > > /m > > On Jul 31, 8:17 pm, "William " <william.bax...(a)oit.edu> wrote: > > > Hi, Im trying to turn my script into a function today, but i dont seem to understand how to do it. > > > function T = trajectory(V,p,angle) > > % > > %documentation > > > <my script here> > > > % > > % > > end > > > That is my understanding of how to create a function. When I do that however I cannot recall on "trajectory" as a function of matlab. Just wondering what I am forgetting. Thanks in advance. |