MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Help: Debuging Functions in Mathematica

  • To: mathgroup at smc.vnet.net
  • Subject: [mg16903] RE: [mg16860] Help: Debuging Functions in Mathematica
  • From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
  • Date: Tue, 6 Apr 1999 01:27:31 -0400
  • Sender: owner-wri-mathgroup at wolfram.com

Boris Breznen  wrote:
bbreznen at vis.caltech.edu
---------------------------
<snip>

When you write a function in Matlab, you save it to a text file with
extension .m and then simply type the name of the file (function) at the
Matlab prompt to use it. When you make changes in the source code you type
"clear myFunction" at matlab prompt, which removes the function definition
and then re-type the function name again. As simple as it gets ...

Now, how do you do the same thing in Mathematica ? I have a function that I
saved in a package format. The directory that contains the package is part
of the $Path. When I put 
Needs ["myFunction`"] in a notebook the function works fine.  But now I want
to change the source code. I edit the package, go back to the notebook type
Remove[myFunction] and at that
point Mathematica refuses to read the function again. Doesn't matter if I
use Needs, or <<, Mathematica doesn't re-load the function. How the hell do
you do this trivial task ?

----------------------------------

Did you have Remove[myFunction] in the same cell as  <<myFunction ?  That
won't work.  You have to evaluate a cell containing Remove[myFunction].
Once that evaluation completes you can evaluate a cell containing
<<myFunction .

Also does myFunction have the Protected attribute?  If it does you need to
unprotect it before you can remove it.  The lines below should work for you.
If they don't send in a simple example that demonstrates your problem.


In[23]:=
Unprotect[myFunction];
Remove[myFunction]

In[24]:=
<<myFunction


---------------------
Regards,
Ted Ersek


  • Prev by Date: technical trader
  • Next by Date: Help needed with List!
  • Previous by thread: RE: Help: Debuging Functions in Mathematica
  • Next by thread: Re: Help: Debuging Functions in Mathematica