Re: initialize cells
- To: mathgroup at smc.vnet.net
- Subject: [mg93050] Re: initialize cells
- From: "David Park" <djmpark at comcast.net>
- Date: Fri, 24 Oct 2008 02:34:04 -0400 (EDT)
- References: <email@example.com>
To initialize a cell, select the cell bracket on the right hand side and use
Alt-cpi, or use the Menu/Cell/Cell Properties/Initialization Cell command.
When you first save a notebook with initialization cells you will be given a
choice of whether you wish to create an autosave package. If you choose to
do that a .m package file will be created and everytime you update the
notebook and save it, the .m package file will also be updated. The .m
package will contain only the initialization cells. You should never
actually have to look at the .m file. You could load the package with a
Needs or Get statement.
If you choose not to create an autosave package, then the notebook will just
be saved 'as is' including the initialization cells. When you subsequently
open the notebook in a fresh section, and try to evaluate some some cell in
the notebook, Mathematica will ask you if you want to first evaluate the
initialization cells. The answer should generally be yes. You can also use
the Option Inspector to set the Notebook, Evaluation option such that
Mathematica will ask if you want to evaluate all the initialization cells as
soon as you open the notebook.
A method that I use is to make Initialization and Routines (also
initialized) Sections at the top of the notebook and put all the
initializations there. The Routines Section might contain routines I have
developed along the way, or even common data. I would usually write usage
messages and SyntaxInformation for all of these. Then as I work along and
develop other notebooks I just copy these sections into the other notebook.
I never work with several notebooks at once, that may have dependent code. I
consider it inconvenient to work with more than one notebook at a time.
(However, others may be comfortable with it.) Then, when I'm happy with the
routines and material in the Routines Section I may create a package with
them, or move them over to an existing package. Since they have already been
defined and tested it's all pretty simple.
djmpark at comcast.net
"Tugrul Temel" <temelt at xs4all.nl> wrote in message
news:gdms9e$gn$1 at smc.vnet.net...
> How do you initialize cells in an NB file?
Prev by Date:
Re: Controlling the order of evaluations
Next by Date:
Re: Re: Is there a simple way to transform 1.1 to 11/10?
Previous by thread:
Re: initialize cells
Next by thread:
How to write some texts to a existed notebook