Message Boards Message Boards

Use Popupmenu with a table?

Posted 6 years ago

I am fairly new to Mathematica, so I apologize if this question is very basic, but I was unable to find what I was looking for in other help documentation. What I am wanting to do is create a pop up menu where someone could select the temperature of water, then assign all the corresponding values of the water properties at the temperature. i.e.

PopupMenu[watertemp, {40, 45, 50, 55}]

Then based upon which temperature is selected assign the corresponding values to the viscosity, density, surface tension, etc. variables.

POSTED BY: Nick Perry
Posted 6 years ago

You can always do something easy like:

assignWaterProps[Dynamic[var_], temp_]:=
 (
   var["temp"]=temp;
   var["prop"]=calcProp[temp, "prop"];
   ...
  )

PopupMenu[Dynamic[temp, (assignWaterProps[Dynamic[var], #])&]

where var is whatever Symbol you're storing your properties in.

POSTED BY: b3m2a1 ​ 
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