Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.4K Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Dynamic again

I want to build a tasks distributor.

This small example doesn't work.

I get a message on the error window.

Where do I put the Dynamic? (again)

Thanks.

Attachments:
POSTED BY: Ernesto Espinosa
3 Replies

Sean:

I sent a very short and buggy example before. I send now my real problem, it´s a little long but the idea is clear. It's almost the same code as before. Functions within Mathematica, but it does not work when I’ am trying to produce my CDF file. That is the real problem.

I am in search of an error out of my reach.

I thank you for your time.

Attachments:
POSTED BY: Ernesto Espinosa
POSTED BY: Sean Clarke

The problem here isn't with dynamic.

The first step in debugging any problem like this is to make the simplest possible example of it. Remove the inessential parts of the code.

Here is a simple example of your problem:

m = 2;

(* Why is the value always Null?*)
Dynamic[Switch[m,
  1, Print["a"],
  2, Print["b"]
  ]]

What does the following code do?

Switch[1,
      1, Print["a"],
      2, Print["b"]
      ]

The code prints the value "a" to the screen and returns Null. Please make sure you understand this. You want it to return the value "a" instead of printing it to the screen:

m = 2;
Dynamic[Switch[m,
  1, "a"
  2, "b"
  ]]
POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard