MathGroup Archive 2012

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

Search the Archive

Re: Transfer dynamic into static variables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125261] Re: Transfer dynamic into static variables
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Fri, 2 Mar 2012 07:52:12 -0500 (EST)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201203011030.FAA13120@smc.vnet.net>

Dynamic's only useful and interesting purpose is to exist as output in a space on the screen. If you're assigning it to the variable 'tl', then 'tl' is pretty useless unless it ends up on the screen.  So I'm left a little confused as to exactly what you're trying to accomplish.

Without more context, it's difficult for me to know exactly how to answer your question, but I'll give it two tries.

1) The Dynamic expression in tl is no different in essence than a Hold[]-wrapped expression. And so using standard expression-manipulation techniques.  E.g., tl2 = First[tl] literally does what you want.  But it's only going to do so at the snapshot in time when 'tl2 = First[tl]' is evaluated.

2) You could keep 'tl2' up to date by doing the assignment inside the Dynamic.
Dynamic[tl2 = {{a, "tst1"}, {c, "tst2"}}]
which would allow 'tl2' to track the variables 'a' and 'c' if they end up changing. Of course, it will only stay up-to-date when the Dynamic is updating, which will only happen if the Dynamic has an onscreen presence.

Sincerely,

John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.


On Mar 1, 2012, at 4:30 AM, Dominik Hezel wrote:

> Hallo,
>
> I have a complex program and now I need to convert a list with dynamic content into a list with static content, hence (simplified):
>
> tl = Dynamic[{{a, "tst1"}, {c,"tst2"}}]
>
> into
>
> tl2 ={{a, "tst1"}, {c,"tst2"}}
>
> So I can start doing normal list operations such as Extract, DeleteCases, etc. If this doesn't work I'll have quite a problem. So I'd really appreciate any advice.
>
> thanks,  Dominik
>




  • Prev by Date: Re: Automatic Numbering in Mathematica
  • Next by Date: Re: Why no OpenCL output on iMac OS X Lion?
  • Previous by thread: Transfer dynamic into static variables
  • Next by thread: Re: Transfer dynamic into static variables