2
$\begingroup$

I have the following list:

{{{Dose -> -15.5527}, {Dose -> 11.6739}}, {{Dose -> -38.1527}, {Dose -> 4.75876}}, {{Dose -> -46.9014}, {Dose -> 3.87109}}}

This was generated by the following function:

Table[Solve[x, Dose], {x, Thread[functions == 0.05]}]

How should I go about selecting only the positive elements of this list and prepend titles to it? I'd like end up with something like:

X-Rays:    11.67 Gy
6.3 Mev:   4.76  Gy
4.3 MeV:   3.87  Gy
$\endgroup$
1
$\begingroup$
TableForm@Transpose@
   {
     {"X-Rays:", "6.3 MeV:", "4.3 MeV:"}
     , ToString[#] <> " Gy" & /@ Select[Dose /. Join @@ lst, Positive]
   }

enter image description here

To get the rounded numbers as you have displayed, replace the Select expression with

Select[Round[Dose /. Join @@ lst, 0.01], Positive]
$\endgroup$
1
$\begingroup$
Grid[
 Transpose[{
   {"X-Rays:", "6.3 MeV:", "4.3 MeV:", "2.2 MeV:"},
   Cases[Catenate@list, {Rule[_, a_?Positive]} :> Round[a, 0.01]],
   Array["Gy" &, Length@cas]}],
 Frame -> True,
 Spacings -> {2, 1.5},
 Alignment -> {{Left, Right}}]

enter image description here

$\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.