0
$\begingroup$
   Manipulate[
    Module[{stot, s, Usite, H, Ps, Pw, deltap, Cp, V, Q, m, E},
  E = m*enthalpie*hour/effi;
  m = 60*Q*rho;
  Q = V*A;
  V = Cd*K*deltap^0.5;
  deltap = Ps + Pw;
  Ps = 0.00598*(rho0 - rhoi)*g*H*Ct;
  Pw = 0.0129*Cp*rho*Usite^2/2;
  Usite = stot*umet*(D/gamma)^alpha;
  stot = f*s/ftot;
  s = 0.5*((s1 + s2)*cos[phi]^2 + (s1 - s2)*cos[phi] + (s3 + s4)*
   sin[phi]^2 + (s3 - s4)*sin[phi]);
 Cp = 0.3*cos[phi]^0.25 + 0.9*cos[phi]^0.75;
 H = Which[csb == 1, Hbuilding, csb == 2, 0, csb == 3, 
0.5*Hbuilding - 3, csb == 4, Hbuilding*0.5]; E], 
Item["Choose Crack Area Type", Alignment -> Left], Delimiter,
 Control[{{csb, 1, ""}, {1 -> "Roof", 2 -> "Wall", 3 -> "Door", 
4 -> "Slab"}, SetterBar}], Delimiter, 
  Item["Observation Parameters", 
  Alignment -> 
   Left], Delimiter, {phi}, {s1}, {s2}, {s3}, {s4}, {f}, {umet}, {D}, \
{alpha}, {gamma}, {rho}, {Ct}, {g}, {effi}, {enthalpie}, {ftot}, \
{rho0}, {rhoi}, {K}, {Cd}, {hour}, Delimiter, 
 Item["Building Geometry", Alignment -> Left], Delimiter,
 Row[{Control[{{A, 150, Row[{"Crack Area"}]}, 0, 50, 2, 
 Appearance -> "Labeled", ImageSize -> Small}], 
 Control[{{Hbuilding, 80, Row[{"Building Height"}]}, 0, 50, 2, 
 Appearance -> "Labeled", Paneled -> True, 
 ContinuousAction -> True, ImageSize -> Small}]}], 
 AppearanceElements -> All]

My question is that, how can I put several inputfield in a same row here in manipulate? And how to make the output result is a numeric value instead of a symbolic expression. Thx a lot.

$\endgroup$
  • 1
    $\begingroup$ Row[{Control[input1...], Control[input2], ... }] -- the same way you put the "crack area" and "building height" into a single row. $\endgroup$ – bill s Jun 12 '15 at 9:15
2
$\begingroup$

To flesh out the comment, you need to add Control to each of the variables, and a Row[ ] to get them in a row.

Row[{Control[{phi}], Control[{s1}], Control[{s2}]}]

will put your first three in a single row.

As a simple example:

Manipulate[phi*s1*s2, 
 Row[{Control[{phi}], Control[{s1}], Control[{s2}]}]]

Notice that the answer contains Nulls until you have entered values for all the variables. Once entered, the calculation is done automatically. You can also add default values:

Row[{Control[{phi, 1}], Control[{s1, 2}], Control[{s2, 3}]}]

so now phi is 1, s1 is 2, etc, until you change them.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.