I would like to export only the minimum values (here I’m finding the minimum Ra for each R0 and these minimum values are indicated in yellow cells) to a .csv file as shown below the code:
ClearAll["Global`*"]
k[R0_, m_] := R0/m;
Ra[Q_, R0_, m_] := Q (R0/m)
data = Table[{Q, R0, m, k[R0, m], Ra[Q, R0, m]}, {Q, 1, 3, 1}, {R0, 1,
1.15, 0.05}, {m, {3.83171, 7.01559, 10.1735, 13.3237, 16.4706,
19.6159}}];
FormatCells[table_] :=
With[{minPosition = Ordering[table, 1, Last[#1] < Last[#2] &]},
MapAt[Item[#, Background -> Yellow] &,
TableForm[{#}, TableDirections -> Row,
TableHeadings -> {None, {"Q", "R0", "m", "k", "Ra"}},
TableSpacing -> {.8, .8}] & /@ table, minPosition]]
FormatTable[table_] := Grid[FormatCells /@ table, Dividers -> All]
FormatTable[data[[1]]]
Export["Min Ra for R0=1,1.05,1.1,1.15.csv", data]
I tried using the export command, but that’s not how I want the output to look like. Is it possible to export the data as shown in the picture?