# Divide a list by a single value from another file, for multiple files

I would like to divide every value from a list by a single value from another data file, but repeatedly for 100+ files.

I import my data as below:

DataSet1 = Import[#, {"Data", All, 6}] & /@ MyFiles1;
SingleValue = Import[#, {"Data", 6}] & /@ MyFiles2;


An example of what DataSet1 and SingleValue would look like is below:

DataSet1 = {{0.00987, 0.12345, 0.06666, 0.04532},{0.02431, 0.07000, 0.13245},{0.01111}}
SingleValue ={{0.123},{0.456},{0.789}}


I would like to divide each list imported in DataSet1 by each single value imported by SingleValue, is there a way to do this?

Thanks!

• Yes, it is possible to do it. Perhaps you could tell us which element you would like to use? Is it based on its position, its value? And perhaps you should consider providing us with two toy model lists. Two small ones, that have the correct dimensions. Thanks a lot in advance!
– bmf
Feb 5, 2023 at 9:37
• I've added some toy lists in, hope that clears it up a little! I'd like to divide each list in the DataSet1, by the corresponding values in SingleValue, if that makes sense? Feb 5, 2023 at 10:08
• You mean you want to divide set 1 in Dataset1 by first number in Single and set 2 in Dataset1 by the second number and so on? If so, you can try DataSet1/Flatten@SingleValue but may be I misunderstood you. !Mathematica graphics Feb 5, 2023 at 10:13
• Also DataSet1 #&/@(Flatten@SingleValue^-1) Mar 15, 2023 at 12:04

Please work with symbols in this case till you have a working solution. It is much easier to verify the transformation.

Clear["Global*"];
DataSet1 = {{a, b, c, d}, {g, h, i}, {j}};
SingleValue = {{p}, {q}, {r}};

DataSet1/# & /@ Sequence @@@ SingleValue


$$\left( \begin{array}{ccc} \left\{\frac{a}{p},\frac{b}{p},\frac{c}{p},\frac{d}{p}\right\} & \left\{\frac{g}{p},\frac{h}{p},\frac{i}{p}\right\} & \left\{\frac{j}{p}\right\} \\ \left\{\frac{a}{q},\frac{b}{q},\frac{c}{q},\frac{d}{q}\right\} & \left\{\frac{g}{q},\frac{h}{q},\frac{i}{q}\right\} & \left\{\frac{j}{q}\right\} \\ \left\{\frac{a}{r},\frac{b}{r},\frac{c}{r},\frac{d}{r}\right\} & \left\{\frac{g}{r},\frac{h}{r},\frac{i}{r}\right\} & \left\{\frac{j}{r}\right\} \\ \end{array} \right)$$

An alternative to the suggestion by @Syed

Flatten[Outer[Times, 1/SingleValue, DataSet1], 1];
% // MatrixForm
`