I'm working with Mathematica, I begin by importing the data from some CSV files, and I store them under some variable names. For the moment let's assume we use:
sample1 = Sort[RandomReal[{0, 10}, {10, 2}]];
sample2 = Sort[RandomReal[{0, 10}, {10, 2}]];
sample3 = Sort[RandomReal[{0, 10}, {10, 2}]];
So, I want to do some calculations on the data individually, I was thinking of using a PopupMenu by "recalling" the defined variables and then I could do a linear fit and display both the data and the linear fit, and also find the highest value:
variables = Names["Global`*"];
PopupMenu[Dynamic[x], variables]
data=Dynamic[x];
lm = LinearModelFit[data, x, x];
Show[ListLinePlot[data, PlotRange-> All],
Plot[lm[x], {x, 0, data[[Length[data], 1]]}]]
Peak = Max[data[[All, 2]]]
But the problem is that when i recall the variables, Mathematica only brings them as names and not the actual data list.
For the moment I'm trying also to store different calculations on a bigger list that would go on storing the values for the calculations:
Data = {};
(This bit would be outside, with the data importing probably, just to define the list)
AppendTo[Data, {Normal[lm], Peak}]
I'm also trying to store the name of the set that's selected, so that's another challenge... Would anyone know how could I solve this issue?
I do realize that it's a pretty specific question (sorry!), but it could be used for other things too! I think...
Thanks!