I wonder how I could export a list of files from Mathematica to my notebook directory.
I use Mathematica to normalize my spectra (CSV files) and then, I would like to export them back to my notebook directory once they are normalized. I tried some codes, but I don't know where the error is coming from.
My files are infrared spectra, they are basically two colums of data (the wavelength from 450 to 4000 and the absorption value for each wavelength). For now, with the followig code, I am able to export all of them, but the first one is complete, the second file starts at 451, the third one at 452, the fourth one at 453 (and so far and so on).
The plot is the following, and my problem is with the last part
Do[
Export[
NotebookDirectory[] <> "ZnO_TiO2_normalized" <> ToString[n]` <> ".csv",
fitdatnorm[[n; All]]],
{n, 1, 18, 1}];"
but I give all the code in case of you need it.
min = 1500;
max = 1900;
a = 450;
intlistpaint = {};
Dynamic[i]
Do[
datpaint1 = Import[files[[i]]];
f[x_] = Interpolation[datpaint1, InterpolationOrder -> 1][x];
fitdat = {Table[x, {x, 450, 4000}],
Table[f[x], {x, 450, 4000}]}\[Transpose];
fitdatnorm = {fitdat\[Transpose][[1]], (fitdat\[Transpose][[2]] - fitdat[[1820 - a, 2]])/ fitdat[[1738 - a, 2]]}\[Transpose];
fit2 = NonlinearModelFit[fitdatnorm[[1700 - a ;; 1900 - a]],
{pearson[x, x0, c, \[CapitalDelta], m, \[Nu]]},{{x0, 1738}, {c, 0.5},{\[CapitalDelta], 35}, {m, 0.65}, {\[Nu], 0.65}}, x];
(*Show[ListPlot[fitdatnorm\[LeftDoubleBracket]1500-a;;1900-a\\[RightDoubleBracket],PlotRange\[Rule]Full],Plot[fit2[t],{t,1450,1900}\,PlotStyle\[Rule]{Red,Thick},PlotRange\[Rule]Full]]*)
fitpoints = Table[fit2[j], {j, fitdatnorm\[Transpose][[1]]}];
subdat = {fitdatnorm\[Transpose][[1]],
fitdatnorm\[Transpose][[2]] - fitpoints}\[Transpose];
(*ListPlot[subdat\[LeftDoubleBracket]1500-a;;1900-a\\[RightDoubleBracket]]*)
AppendTo[intlistpaint, Integrate[Interpolation[subdat,InterpolationOrder -> 1][x], {x, 1510, 1620}]];,
{i, 1, 18}]
ListPlot[intlistpaint, PlotRange -> Full]
intlistpaint
intlist
Do[Export[NotebookDirectory[] <> "ZnO_TiO2_normalized" <> ToString[n]` <>
".csv", fitdatnorm[[n; All]]], {n, 1, 18, 1}];
ToString
? Syntax error you repeat in several places. $\endgroup$ – george2079 Jan 23 '18 at 16:49