Message Boards Message Boards

How Can I Control When Manipulate Refreshes or Re-evaluates?

Posted 9 years ago

Hello everyone,

I have a simple Manipulate that does just two things: (1) it performs a data analysis, which takes about 20 seconds, based on the my choice of a sample in a popup menu; and (2), because the output has multiple parts, it allows the me to display different parts by choosing from a tab menu. There is never a need to repeat the data analysis in (1) unless I choose a different sample, but unfortunately that is exactly what happens every time the I choose to look at a different part in (2). So, how to I get Mathematica to analyze the data only when I choose a new sample?

Gregory

POSTED BY: Gregory Lypny
2 Replies
Posted 9 years ago

Thanks for the suggestion, Hans,

I'll have to study this!

POSTED BY: Gregory Lypny
Posted 9 years ago

Maybe something like this:

Manipulate[
    If[choice != oldchoice,
     oldchoice = choice;
     sample = Partition[10 choice Range@6, 2];
     Pause@3
    ];
    sample[[part]],
    {{choice, 1, "Sample choice"}, Range@10},
    {{part, 1, "Part of sample"}, Range@3},
    {sample, ControlType -> None},
    {oldchoice, 2, ControlType -> None},
    TrackedSymbols :> {choice, part}
 ]
POSTED BY: Hans Milton
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract