0
$\begingroup$

I am trying to export the data from a B Spline Function to a table in excel. I have tried exporting as many different file types (.xls, .txt, .dat), but all of them show up in excel as all of the data in one cell.

Currently, all I have successfully done is this, showing a plot of "data1", a set of ordered pairs that I imported, and the B-spline fit for this data set.

f = BSplineFunction[data1]
Show[
 ListLinePlot[data1, PlotStyle -> Red], 
 ParametricPlot[f[t], {t, 0, 1}]]

I would like to export the data from the B-spline function in a way that can be viewed as a table in Excel.

$\endgroup$
  • 1
    $\begingroup$ Can you give us some idea of what data1 looks like? $\endgroup$ – bill s May 30 '13 at 14:36
  • $\begingroup$ data1 is a set of about 500 of these ordered pairs, with the x-coordinate ranging from 0.3 to 12, in varying step sizes: {0.3, 0.0558}, {0.302, 0.0556}, {0.304, 0.0554}, {0.306, 0.0552}, {0.308, 0.0552}, {0.31, 0.055}, {0.312, 0.0548}, {0.314, 0.0546}, {0.316, 0.0544},... $\endgroup$ – Mattie May 30 '13 at 14:46
  • $\begingroup$ Now I don't understand: what do you mean the "data" from the Bspline... this is an interpolating function, it is not data. Do you want values of the f (the B-spline function) at certain points? $\endgroup$ – bill s May 30 '13 at 15:14
  • $\begingroup$ Yes. sorry about that. I am looking for the values of f $\endgroup$ – Mattie May 30 '13 at 15:37
2
$\begingroup$

You probably want to map your function over a suitable list of points which fit the needs of the values you require.

RandomInteger[{1, 10}, {20,2}];

f = BSplineFunction[%]

Export["myfile.tsv",f[#]&/@ Range[0, 1, 0.1]]

{{31., 76.}, {52.4823, 17.653}, {29.8387, 21.6133}, {47.3833, 64.0472}, {39.5027, 23.1}, {53.2083, 46.5833}, {58.128, 67.6787}, {62.9102, 39.1387}, {39.7933, 19.064}, {90.7272, 26.2918}, {21., 66.}}

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