MathGroup Archive 2012

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

Search the Archive

Re: Evaluate code fragment without making new cell for it?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127180] Re: Evaluate code fragment without making new cell for it?
  • From: Helen Read <readhpr at gmail.com>
  • Date: Thu, 5 Jul 2012 06:14:20 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <jt0rjg$1dp$1@smc.vnet.net>

On 7/4/2012 3:33 AM, Nasser M. Abbasi wrote:
> On 7/3/2012 2:48 AM, Nasser M. Abbasi wrote:
>
>> But I use Manipulate alot, and you can't split Manipulate
>> into cells.
>>
>
> I forgot to add other cases where I was not able to split things
> into different cell. This is when I use a Module[]. It has to
> be in all in one cell on its own. Also a Block[]. Actually it
> seems anything that starts with a [ and ends with a ]  can not
> be broken into different cells. Also can't break a list into
> different cells. That all seems logical to me.
>
> So if one has a large Module[], then to evaluate a code fragment
> that sits in the body of the Module, one needs to copy it out
> into its own cell to do that.

It's often best to build up a Module gradually. Get little fragments of 
it working outside a Module, in individual cells. Then start combining 
steps in one cell. Then when THAT is working, put it into a Module.

Another thing that's very helpful is to put Print[] statements in your 
Module, so that you can see exactly what's happening. If you want to 
know what this or that fragment does, name the result of that fragment 
(which you have probably done already anyway) and print it. Sometimes 
I'll print the output of nearly every line of code in a Module, to see 
exactly what's going on at each step. Once it's all working, take out 
all the extra Print statements.


-- 
Helen Read
University of Vermont





  • Prev by Date: Re: NonlinearModelFit to multiple data sets simultaneously?
  • Next by Date: Re: retina display
  • Previous by thread: Re: Evaluate code fragment without making new cell for it?
  • Next by thread: Re: Evaluate code fragment without making new cell for it?